Index.h revision ba1da14e79c1ecd49306e5175b69baa1e7ed4293
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 207fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidistypedef enum { 208fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 209fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that no special CXIndex options are needed. 210fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 211fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_None = 0x0, 212fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 213fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 214fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that threads that libclang creates for indexing 215fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * purposes should use background priority. 216fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * Affects \see clang_indexSourceFile, \see clang_indexTranslationUnit, 217fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \see clang_parseTranslationUnit, \see clang_saveTranslationUnit. 218fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 219fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, 220fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 221fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 222fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that threads that libclang creates for editing 223fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * purposes should use background priority. 224fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * Affects \see clang_reparseTranslationUnit, \see clang_codeCompleteAt, 225fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \see clang_annotateTokens 226fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 227fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, 228fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 229fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 230fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that all threads that libclang creates should use 231fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * background priority. 232fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 233fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForAll = 234fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForIndexing | 235fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForEditing 236fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 237fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis} CXGlobalOptFlags; 238fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 239fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/** 240fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Sets general options associated with a CXIndex. 241fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 242fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * For example: 243fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \code 244fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * CXIndex idx = ...; 245fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * clang_CXIndex_setGlobalOptions(idx, 246fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * clang_CXIndex_getGlobalOptions(idx) | 247fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); 248fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \endcode 249fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 250fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. 251fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 252fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); 253fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 254fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/** 255fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Gets the general options associated with a CXIndex. 256fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 257fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that 258fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * are associated with the given CXIndex object. 259fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 260fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); 261fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 2621efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 263c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_FILES File manipulation routines 264f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 265f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{ 266f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 2671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 268f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 269f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief A particular source file that is part of a translation unit. 270f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 271f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregortypedef void *CXFile; 2721efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 273f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor 274f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 275f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the complete file and path name of the given file. 27688145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff */ 27774844072411bae91d5dbb89955d200cbe1e0a1c8Ted KremenekCINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); 2781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 279f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 280f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the last modification time of the given file. 281f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 28208b0e8daeb683686b876d72674962ad96df21d45Douglas GregorCINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); 28388145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff 2843c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/** 285dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against 286dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional 287dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * #ifndef/#define/#endif macro guards or with #pragma once. 288dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */ 289dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned 290dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); 291dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor 292dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/** 293b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit. 294b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 295b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit 2961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 297b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file. 298b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 299b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu, 300b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit. 301b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 3021efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, 303b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor const char *file_name); 3041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 305b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 306f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 307f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 308f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor 309f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 310f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations 311f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 312f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in 313f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of 314f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are 315f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular 316f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract 317f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types. 318f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 319f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{ 320f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 3211efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 322f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 3231db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation 3241db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit. 3251db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 32620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation() 327a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column. 3283c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3293c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 3305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor void *ptr_data[2]; 3311db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned int_data; 3323c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation; 333fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3343c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/** 335d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code. 3363c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor * 3371db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the 3381db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively. 3393c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3403c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 3415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor void *ptr_data[2]; 3421db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned begin_int_data; 3431db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned end_int_data; 3443c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange; 345fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3461db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 347b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location. 348b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 349b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getNullLocation(); 3501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 351b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 352b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \determine Determine whether two source locations, which must refer into 3531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source 354b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code. 355b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 356b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero 357b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations. 358b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 359b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, 360b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation loc2); 3611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 362b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column 3641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit. 365b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 366b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, 367b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXFile file, 368b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned line, 369b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned column); 37083889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/** 37183889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset 37283889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit. 37383889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */ 37483889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, 37583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall CXFile file, 37683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall unsigned offset); 3771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 378b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range. 3805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 3815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getNullRange(); 382896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 384b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source 385b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations. 386b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 387b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, 388b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation end); 3891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 390b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 391ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent. 392ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * 393ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ. 394ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */ 395ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, 396ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor CXSourceRange range2); 397ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor 398ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/** 399de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis * \brief Returns non-zero if \arg range is null. 400de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */ 401733dbc805facad7cebec5420f6c47c83848cee5fErik VerbruggenCINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); 402de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis 403de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/** 40446766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by 40546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location. 4061db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 40720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the 40820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion. 409a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 4101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed 4111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts. 4121db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4131efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given 4141db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4151db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given 4171db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4181db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given 4201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points. 42146766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * 42246766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 42346766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points. 4241db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 42520174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, 42620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth CXFile *file, 42720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *line, 42820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *column, 42920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *offset); 43020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth 43120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/** 432e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by 433e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive. 434e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 435e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c 436e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 437e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1 438e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 439e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void) 440e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * { 441e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * return 0; 442e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * } 443e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 444e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be 445e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 446e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12 447e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 448e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned 449e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 450e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12 451e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 452e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed 453e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts. 454e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 455e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the 456e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files, 457e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when 458e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If 459e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value 460e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid 461e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned. 462e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 463e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the 464e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 465e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 466e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the 467e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 468e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */ 469e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, 470e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis CXString *filename, 471e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *line, 472e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *column); 473e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis 474e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/** 47520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented 47620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location. 47720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * 47820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface 47920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \see clang_getExpansionLocation(). See that interface's documentation for 48020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details. 48120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */ 4821db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, 4831db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor CXFile *file, 4841db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned *line, 48546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *column, 48646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *offset); 487e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor 488e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/** 489a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by 490a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location. 491a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 492a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the 493a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file. 494a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 495a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed 496a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts. 497a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 498a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given 499a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 500a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 501a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given 502a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 503a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 504a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given 505a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 506a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 507a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 508a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points. 509a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */ 510a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, 511a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor CXFile *file, 512a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *line, 513a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *column, 514a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *offset); 515a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor 516a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/** 5171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a 5181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 5191db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 5201db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); 5211db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 5221db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 5231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a 5241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 5251db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 5261db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); 5271db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 528f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 529f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 530f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 531c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 532c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 5335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting 5345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 5355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 5365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 5395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic. 5405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity { 5425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 543896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief A diagnostic that has been suppressed, e.g., by a command-line 5445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * option. 5455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Ignored = 0, 547896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 5485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 5495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic is a note that should be attached to the 5505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * previous (non-note) diagnostic. 5515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Note = 1, 5535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 5555352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates suspicious code that may not be 5565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * wrong. 5575352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Warning = 2, 5595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 5615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed. 5625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Error = 3, 5645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 5665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed such 5675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * that future parser recovery is unlikely to produce useful 5685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * results. 5695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Fatal = 4 5715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor}; 5725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 5745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity, 5755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints. 5765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic; 5785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 580153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief A group of CXDiagnostics. 581153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 582153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenektypedef void *CXDiagnosticSet; 583153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 584153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 585153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Determine the number of diagnostics in a CXDiagnosticSet. 586153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 587153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); 588153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 589153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 590153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet. 591153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 592153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Unit the CXDiagnosticSet to query. 593153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Index the zero-based diagnostic number to retrieve. 594153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 595153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns the requested diagnostic. This diagnostic must be freed 596153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * via a call to \c clang_disposeDiagnostic(). 597153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 598153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, 599153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek unsigned Index); 600153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 601153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 602153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 603153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Describes the kind of error that occurred (if any) in a call to 604153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \c clang_loadDiagnostics. 605153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 606153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenekenum CXLoadDiag_Error { 607153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 608153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that no error occurred. 609153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 610153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_None = 0, 611153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 612153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 613153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that an unknown error occurred while attempting to 614153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserialize diagnostics. 615153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 616153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_Unknown = 1, 617153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 618153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 619153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the file containing the serialized diagnostics 620153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * could not be opened. 621153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 622153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_CannotLoad = 2, 623153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 624153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 625153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the serialized diagnostics file is invalid or 626153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * corrupt. 627153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 628153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_InvalidFile = 3 629153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek}; 630153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 631153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 632153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode 633153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * file. 634153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 635153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param The name of the file to deserialize. 636153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param A pointer to a enum value recording if there was a problem 637153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserializing the diagnostics. 638153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param A pointer to a CXString for recording the error string 639153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * if the file was not successfully loaded. 640153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 641153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These 642153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * diagnostics should be released using clang_disposeDiagnosticSet(). 643153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 644153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, 645153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek enum CXLoadDiag_Error *error, 646153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXString *errorString); 647153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 648153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 649153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Release a CXDiagnosticSet and all of its contained diagnostics. 650153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 651153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); 652153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 653153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 654153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve the child diagnostics of a CXDiagnostic. This 655153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * CXDiagnosticSet does not need to be released by clang_diposeDiagnosticSet. 656153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 657153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); 658153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 659153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 660a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given 661a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit. 662a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 663a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); 664a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 665a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 666a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit. 6675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 668a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query. 669a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 6705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 671a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 672a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 6735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 674a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, 675a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 676a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 677a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 6780373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \brief Retrieve the complete set of diagnostics associated with a 6790373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * translation unit. 6800373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * 6810373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \param Unit the translation unit to query. 6820373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek */ 6830373fcc3e5b205cc26656c70d7dff737b0e08345Ted KremenekCINDEX_LINKAGE CXDiagnosticSet 6840373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); 6850373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek 6860373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek/** 687a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic. 688a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 689a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); 6905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 6920a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics. 6930a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 6940a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the 6950a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * behavior of \c clang_displayDiagnostic(). 6960a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 6970a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions { 6980a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 6990a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Display the source-location information where the 7000a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic was located. 7010a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7020a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * When set, diagnostics will be prefixed by the file, line, and 7030a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * (optionally) column to which the diagnostic refers. For example, 7040a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7050a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \code 7060a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * test.c:28: warning: extra tokens at end of #endif directive 7070a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \endcode 7080a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-source-location. 7100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7110a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplaySourceLocation = 0x01, 7120a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7130a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 7140a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 7150a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include the column number. 7160a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7170a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-column. 7180a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7190a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplayColumn = 0x02, 7200a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 7220a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 7230a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include information about source ranges in a 7240a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * machine-parsable format. 7250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 726896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * This option corresponds to the clang flag 7270a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \c -fdiagnostics-print-source-range-info. 7280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 729aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplaySourceRanges = 0x04, 730aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 731aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 732aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the option name associated with this diagnostic, if any. 733aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 734aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The option name displayed (e.g., -Wconversion) will be placed in brackets 735aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * after the diagnostic text. This option corresponds to the clang flag 736aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-option. 737aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 738aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayOption = 0x08, 739aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 740aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 741aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category number associated with this diagnostic, if any. 742aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 743aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category number is displayed within brackets after the diagnostic text. 744aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 745aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=id. 746aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 747aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryId = 0x10, 748aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 749aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 750aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category name associated with this diagnostic, if any. 751aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 752aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category name is displayed within brackets after the diagnostic text. 753aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 754aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=name. 755aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 756aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryName = 0x20 7570a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor}; 7580a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7590a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 760274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display. 7610a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 762274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering 763896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The 764896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of 7650a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler. 7660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print. 7680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 769896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display, 7700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values. 771274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * 772274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic. 7730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 774274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, 775274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor unsigned Options); 7760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7770a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 7780a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the 7790a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler. 7800a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7810a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c 7820a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * clang_displayDiagnostic(). 7830a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7840a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); 7850a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7860a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 7875352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic. 7885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 789896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity 7905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic); 7915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 7925352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 7935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic. 7945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 7955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when 7965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line. 7975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 7985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); 7995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 8015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic. 8025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 8035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); 804a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor 805a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/** 806aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this 807aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic. 808aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 809aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried. 810aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 811aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this 812aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any). 813aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 814aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this 815aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic". 816aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 817aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, 818aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXString *Disable); 819aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 820aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 821aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic. 822aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 823aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related 824aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine 825aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic. 826aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 827aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero 828aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized. 829aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 830aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); 831aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 832aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 833aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of a particular diagnostic category. 834aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 835aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by 836aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory(). 837aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 838aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category. 839aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 840aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticCategoryName(unsigned Category); 841aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 842aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 843a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given 844a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic. 845a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */ 846a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); 847896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 8485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 849a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic. 8505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 851a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source 8525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by 853896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters. 8545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 855a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted. 8565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 857896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to 8585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 859a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range. 8605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 861896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, 862a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor unsigned Range); 8635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 8655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the 8665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic. 8675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 8685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); 8695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 871473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it. 8725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 873473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents 874473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over 875473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers 876473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty), 877473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be 878473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and 879473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the 880473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to 881473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert). 8825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 883473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried. 8845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 885473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it. 8865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 887473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be 888473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source 889473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be 890473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b. 8915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 892473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source 893473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange. 8945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 895896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, 896473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor unsigned FixIt, 897473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor CXSourceRange *ReplacementRange); 8985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 9015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation 9055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy 9075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or 9085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit. 9095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 9115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 912896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 9135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name. 9155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString 9175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); 9185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided 9215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler. 9225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional. If the caller provides a 9245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the 9255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments. 9265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options 9285352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored: 9295352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-c' 9315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-emit-ast' 9325352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-fsyntax-only' 9335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-o <output file>' (both '-o' and '<output file>' are ignored) 9345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9351ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be 9361ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated. 9375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param source_filename - The name of the source file to load, or NULL if the 9391ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args. 9401ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 9411ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in 9421ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args. 9431ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 9441ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be 9451ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process. 9461ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation 9471ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c', 9481ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'. 9495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 9515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files. 9525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 9545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of 955c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files. The contents and name of these files (as specified by 956c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to 957c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns. 9585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( 9605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXIndex CIdx, 9615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor const char *source_filename, 9625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor int num_clang_command_line_args, 9632ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor const char * const *clang_command_line_args, 9645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor unsigned num_unsaved_files, 965a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor struct CXUnsavedFile *unsaved_files); 966896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 9675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Create a translation unit from an AST file (-emit-ast). 9695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 970896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex, 971a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor const char *ast_filename); 9725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 97344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/** 97444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units. 97544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 97644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise 97744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when 97844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit. 97944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 9805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags { 9815a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 9825a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that no special translation-unit options are 9835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * needed. 9845a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 9855a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor CXTranslationUnit_None = 0x0, 9865a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 9875a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 9885a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that the parser should construct a "detailed" 9895a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * preprocessing record, including all macro definitions and instantiations. 9905a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 9915a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * Constructing a detailed preprocessing record requires more memory 9925a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * and time to parse, since the information contained in the record 9935a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is usually not retained. However, it can be useful for 9945a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * applications that require more detailed information about the 9955a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * behavior of the preprocessor. 9965a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 99744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor CXTranslationUnit_DetailedPreprocessingRecord = 0x01, 99844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 99944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 1000b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Used to indicate that the translation unit is incomplete. 100144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 1002b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * When a translation unit is considered "incomplete", semantic 1003b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * analysis that is typically performed at the end of the 1004b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * translation unit will be suppressed. For example, this suppresses 1005b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * the completion of tentative declarations in C and of 1006b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * instantiation of implicitly-instantiation function templates in 1007b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * C++. This option is typically used when parsing a header with the 1008b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * intent of producing a precompiled header. 100944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1010b1c031be513705d924038f497279b9b599868ba1Douglas Gregor CXTranslationUnit_Incomplete = 0x02, 101144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 101244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 101344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Used to indicate that the translation unit should be built with an 101444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header for the preamble. 101544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 101644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * An implicit precompiled header is used as an optimization when a 101744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * particular translation unit is likely to be reparsed many times 101844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * when the sources aren't changing that often. In this case, an 101944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header will be built containing all of the 102044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * initial includes at the top of the main file (what we refer to as 102144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * the "preamble" of the file). In subsequent parses, if the 102244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * preamble or the files in it have not changed, \c 102344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * clang_reparseTranslationUnit() will re-use the implicit 102444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * precompiled header to improve parsing performance. 102544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1026e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXTranslationUnit_PrecompiledPreamble = 0x04, 1027e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1028e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1029e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that the translation unit should cache some 1030e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion results with each reparse of the source file. 1031e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1032e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * Caching of code-completion results is a performance optimization that 1033e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * introduces some overhead to reparsing but improves the performance of 1034e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion operations. 1035e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 103699ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor CXTranslationUnit_CacheCompletionResults = 0x08, 103799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1038b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * \brief DEPRECATED: Enable precompiled preambles in C++. 103999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 104099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * Note: this is a *temporary* option that is available only while 1041b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * we are testing C++ precompiled preamble support. It is deprecated. 104299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 104399ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor CXTranslationUnit_CXXPrecompiledPreamble = 0x10, 104499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor 104599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1046b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * \brief DEPRECATED: Enabled chained precompiled preambles in C++. 104799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 104899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * Note: this is a *temporary* option that is available only while 1049b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * we are testing C++ precompiled preamble support. It is deprecated. 105099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 1051e1d4330adaaa7faf093e725c9c993207eb2d778aArgyrios Kyrtzidis CXTranslationUnit_CXXChainedPCH = 0x20 10525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor}; 10535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 10545a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/** 1055b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation 1056b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited. 1057b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * 1058b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit() 1059b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times, 1060b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly 1061b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag 1062b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled 1063b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The 1064b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next. 1065b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */ 1066e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); 1067b1c031be513705d924038f497279b9b599868ba1Douglas Gregor 1068b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/** 10695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding 10705a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file. 10715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the 10735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be 10745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of 10755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same 10765a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line. 10775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10785a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be 10795a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated. 10805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10815a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the 10821ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p command_line_args. 10835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10845a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be 10855a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process. 10865a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation 10875a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c', 10885a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'. 10895a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10905a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in 10915a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \p command_line_args. 10925a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10935a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 10941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of 10955a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files. The contents and name of these files (as specified by 10965a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 10975a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns. 10985a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10995a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 11005a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files. 11015a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11025a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit 11035a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the 11045a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags. 11055a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11065a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \returns A new translation unit describing the parsed code and containing 11075a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * any diagnostics produced by the compiler. If there is a failure from which 11085a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * the compiler cannot recover, returns NULL. 11095a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 11105a43021ac491bf091494167127772a20d9a9bb48Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx, 11115a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor const char *source_filename, 11122ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor const char * const *command_line_args, 11135a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor int num_command_line_args, 11145a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor struct CXUnsavedFile *unsaved_files, 11155a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor unsigned num_unsaved_files, 11165a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor unsigned options); 11175a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 11185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 11191999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved. 11201999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 11211999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 11221999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when 11231999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit. 11241999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 11251999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags { 11261999844e7a18786e61e619e1dc6c789827541863Douglas Gregor /** 11271999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Used to indicate that no special saving options are needed. 11281999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 11291999844e7a18786e61e619e1dc6c789827541863Douglas Gregor CXSaveTranslationUnit_None = 0x0 11301999844e7a18786e61e619e1dc6c789827541863Douglas Gregor}; 11311999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 11321999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 11331999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation 11341999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit. 11351999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 11361999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for 11371999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag 11381999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with 11391999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data. 11401999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 11411999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); 11421999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 11431999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 114439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to 114539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit(). 114639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 114739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError { 114839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 114939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that no error occurred while saving a translation unit. 115039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 115139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_None = 0, 115239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 115339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 115439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that an unknown error occurred while attempting to save 115539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * the file. 115639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 115739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * This error typically indicates that file I/O failed when attempting to 115839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * write the file. 115939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 116039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_Unknown = 1, 116139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 116239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 116339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that errors during translation prevented this attempt 116439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * to save the translation unit. 116539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 116639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * Errors that prevent the translation unit from being saved can be 116739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). 116839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 116939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_TranslationErrors = 2, 117039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 117139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 117239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that the translation unit to be saved was somehow 117339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * invalid (e.g., NULL). 117439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 117539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_InvalidTU = 3 117639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor}; 117739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 117839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/** 11797ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of 11807ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk. 11817ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 11827ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved 11837ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a 11847ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, 11857ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a 11867ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation 11877ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units. 11887ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 11897ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save. 11901999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 11917ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved. 11927ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 11931999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit 11941999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the 11951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags. 11961999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 119739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError 119839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 119939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred. 12007ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */ 12017ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, 12021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor const char *FileName, 12031999844e7a18786e61e619e1dc6c789827541863Douglas Gregor unsigned options); 12047ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor 12057ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/** 12065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object. 12075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 12085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); 1209896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 12105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1211e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units. 1212e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1213e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 1214e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when 1215e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit. 1216e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1217e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags { 1218e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1219e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that no special reparsing options are needed. 1220e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1221e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXReparse_None = 0x0 1222e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor}; 1223e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1224e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1225e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation 1226e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit. 1227e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1228e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for 1229e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag 1230e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses 1231e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version 1232e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next. 1233e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1234e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); 1235e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1236e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1237abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit. 1238abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1239abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally 1240abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files 1241abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The 1242abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it 1243abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed. 1244abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1245abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations 1246abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation 1247abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then 1248abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments. 1249abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation 1250abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine. 1251abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1252abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The 1253abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with 1254abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile(). 1255abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1256abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 1257abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files. 1258abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1259abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk 1260abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of 1261abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files. The contents and name of these files (as specified by 1262abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 1263abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns. 1264abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1265e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags. 1266e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of 1267e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit. 1268e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1269abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \returns 0 if the sources could be reparsed. A non-zero value will be 1270abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is 1271abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * invalid. In such cases, the only valid call for \p TU is 1272abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_disposeTranslationUnit(TU). 1273abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */ 1274abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, 1275abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor unsigned num_unsaved_files, 1276e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor struct CXUnsavedFile *unsaved_files, 1277e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor unsigned options); 127859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 127959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 128059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Categorizes how memory is being used by a translation unit. 128159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1282f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind { 1283f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_AST = 1, 1284f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Identifiers = 2, 1285f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Selectors = 3, 1286f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_GlobalCompletionResults = 4, 1287457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek CXTUResourceUsage_SourceManagerContentCache = 5, 1288ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek CXTUResourceUsage_AST_SideTables = 6, 1289f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, 1290e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, 1291e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 1292e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 12935e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_Preprocessor = 11, 12945e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_PreprocessingRecord = 12, 1295ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek CXTUResourceUsage_SourceManager_DataStructures = 13, 1296d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch = 14, 1297f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, 1298f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_END = 1299d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch, 1300f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek 1301f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_First = CXTUResourceUsage_AST, 1302d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch 130359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek}; 130459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 130559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 130659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Returns the human-readable null-terminated C string that represents 1307f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * the name of the memory category. This string should never be freed. 130859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 130959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE 1310f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); 131159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1312f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry { 131359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The memory usage category. */ 1314f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek enum CXTUResourceUsageKind kind; 1315f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek /* \brief Amount of resources used. 1316f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek The units will depend on the resource kind. */ 131759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned long amount; 1318f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry; 131959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 132059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 132159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief The memory usage of a CXTranslationUnit, broken into categories. 132259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1323f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage { 132459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief Private data member, used for queries. */ 132559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek void *data; 132659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 132759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The number of entries in the 'entries' array. */ 132859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned numEntries; 132959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 133059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief An array of key-value pairs, representing the breakdown of memory 133159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek usage. */ 1332f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsageEntry *entries; 133359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1334f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage; 133559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 133659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 133759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Return the memory usage of a translation unit. This object 1338f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * should be released with clang_disposeCXTUResourceUsage(). 133959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1340f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); 134159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1342f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); 134359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1344abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/** 13455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 13465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1347896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 13485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1349c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to. 1350c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1351c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind { 1352c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Declarations */ 13531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1354c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A declaration whose specific kind is not exposed via this 13551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1356c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1357c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed declarations have the same operations as any other kind 1358c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of declaration; one can extract their location information, 1359c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, find their definitions, etc. However, the specific kind 1360c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of the declaration is not reported. 1361c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1362c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedDecl = 1, 1363c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ struct. */ 13641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_StructDecl = 2, 1365c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ union. */ 1366c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnionDecl = 3, 1367c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C++ class. */ 1368c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ClassDecl = 4, 1369c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumeration. */ 1370c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumDecl = 5, 13711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1372c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A field (in C) or non-static data member (in C++) in a 1373c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * struct, union, or C++ class. 1374c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1375c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FieldDecl = 6, 1376c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumerator constant. */ 1377c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumConstantDecl = 7, 1378c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function. */ 1379c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FunctionDecl = 8, 1380c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A variable. */ 1381c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_VarDecl = 9, 1382c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function or method parameter. */ 1383c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ParmDecl = 10, 1384c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @interface. */ 1385c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInterfaceDecl = 11, 1386c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @interface for a category. */ 1387c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryDecl = 12, 1388c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @protocol declaration. */ 1389c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolDecl = 13, 1390c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @property declaration. */ 1391c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCPropertyDecl = 14, 1392c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance variable. */ 1393c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCIvarDecl = 15, 1394c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance method. */ 1395c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInstanceMethodDecl = 16, 1396c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C class method. */ 1397c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassMethodDecl = 17, 1398c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @implementation. */ 1399c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCImplementationDecl = 18, 1400c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C @implementation for a category. */ 1401c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryImplDecl = 19, 1402c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A typedef */ 1403c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypedefDecl = 20, 14048bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek /** \brief A C++ class method. */ 14058bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek CXCursor_CXXMethod = 21, 14068f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek /** \brief A C++ namespace. */ 14078f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek CXCursor_Namespace = 22, 1408a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek /** \brief A linkage specification, e.g. 'extern "C"'. */ 1409a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek CXCursor_LinkageSpec = 23, 141001829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ constructor. */ 141101829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Constructor = 24, 141201829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ destructor. */ 141301829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Destructor = 25, 141401829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ conversion function. */ 141501829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_ConversionFunction = 26, 1416fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template type parameter. */ 1417fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTypeParameter = 27, 1418fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ non-type template parameter. */ 1419fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_NonTypeTemplateParameter = 28, 1420fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template template parameter. */ 1421fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTemplateParameter = 29, 1422fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ function template. */ 1423fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_FunctionTemplate = 30, 142439d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor /** \brief A C++ class template. */ 142539d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor CXCursor_ClassTemplate = 31, 142674dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor /** \brief A C++ class template partial specialization. */ 142774dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor CXCursor_ClassTemplatePartialSpecialization = 32, 14286931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** \brief A C++ namespace alias declaration. */ 14296931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceAlias = 33, 14300a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor /** \brief A C++ using directive. */ 14310a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor CXCursor_UsingDirective = 34, 1432162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ using declaration. */ 14337e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor CXCursor_UsingDeclaration = 35, 1434162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ alias declaration */ 1435162e1c1b487352434552147967c3dd296ebee2f7Richard Smith CXCursor_TypeAliasDecl = 36, 1436352697a87bca664356f21a838b162084013625eaDouglas Gregor /** \brief An Objective-C @synthesize definition. */ 1437352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCSynthesizeDecl = 37, 1438352697a87bca664356f21a838b162084013625eaDouglas Gregor /** \brief An Objective-C @dynamic definition. */ 1439352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCDynamicDecl = 38, 14402dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis /** \brief An access specifier. */ 14412dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_CXXAccessSpecifier = 39, 144242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 144350aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek CXCursor_FirstDecl = CXCursor_UnexposedDecl, 14442dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, 14451efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1446c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* References */ 1447c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstRef = 40, /* Decl references */ 14481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_ObjCSuperClassRef = 40, 1449c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolRef = 41, 1450c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassRef = 42, 1451c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1452c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A reference to a type declaration. 1453c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1454c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A type reference occurs anywhere where a type is named but not 1455c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * declared. For example, given: 1456c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1457c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \code 1458c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * typedef unsigned size_type; 1459c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * size_type size; 1460c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \endcode 1461c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1462c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The typedef is a declaration of size_type (CXCursor_TypedefDecl), 1463c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * while the type of the variable "size" is referenced. The cursor 1464c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * referenced by the type of size is the typedef for size_type. 1465c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1466c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypeRef = 43, 14673064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CXCursor_CXXBaseSpecifier = 44, 14680b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor /** 1469a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * \brief A reference to a class template, function template, template 1470a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * template parameter, or class template partial specialization. 14710b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor */ 14720b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor CXCursor_TemplateRef = 45, 14736931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** 14746931900f43cea558c6974075256c07728dbfecc6Douglas Gregor * \brief A reference to a namespace or namespace alias. 14756931900f43cea558c6974075256c07728dbfecc6Douglas Gregor */ 14766931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceRef = 46, 1477a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor /** 147836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a member of a struct, union, or class that occurs in 147936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * some non-expression context, e.g., a designated initializer. 1480a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor */ 1481a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor CXCursor_MemberRef = 47, 148236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** 148336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a labeled statement. 148436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 148536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the jump to "start_over" in the 148636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto statement in the following example: 148736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 148836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 148936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 149036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 149136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 149236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto start_over; 149336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 149436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 149536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * A label reference cursor refers to a label statement. 149636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 149736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelRef = 48, 149836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 14991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor /** 15001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief A reference to a set of overloaded functions or function templates 15011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * that has not yet been resolved to a specific function or function template. 15021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * An overloaded declaration reference cursor occurs in C++ templates where 15041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * a dependent name refers to a function. For example: 15051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \code 15071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> void swap(T&, T&); 15081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct X { ... }; 15101f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(X&, X&); 15111f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> 15131f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void reverse(T* first, T* last) { 15141f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * while (first < last - 1) { 15151f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * swap(*first, *--last); 15161f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * ++first; 15171f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 15181f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 15191f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15201f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct Y { }; 15211f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(Y&, Y&); 15221f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \endcode 15231f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15241f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * Here, the identifier "swap" is associated with an overloaded declaration 15251f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * reference. In the template definition, "swap" refers to either of the two 15261f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * "swap" functions declared above, so both results will be available. At 15271f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * instantiation time, "swap" may also refer to other functions found via 15281f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * argument-dependent lookup (e.g., the "swap" function at the end of the 15291f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * example). 15301f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15311f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * The functions \c clang_getNumOverloadedDecls() and 15321f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c clang_getOverloadedDecl() can be used to retrieve the definitions 15331f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * referenced by this cursor. 15341f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 15351f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor CXCursor_OverloadedDeclRef = 49, 15361f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 1537011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /** 1538011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \brief A reference to a variable that occurs in some non-expression 1539011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * context, e.g., a C++ lambda capture list. 1540011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1541011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_VariableRef = 50, 1542011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1543011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LastRef = CXCursor_VariableRef, 15441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1545c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Error conditions */ 1546c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstInvalid = 70, 1547c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_InvalidFile = 70, 1548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NoDeclFound = 71, 1549c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NotImplemented = 72, 1550ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_InvalidCode = 73, 1551ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_LastInvalid = CXCursor_InvalidCode, 15521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1553c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Expressions */ 1554c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstExpr = 100, 15551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1556c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1557c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression whose specific kind is not exposed via this 15581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1559c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1560c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed expressions have the same operations as any other kind 1561c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of expression; one can extract their location information, 1562c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, children, etc. However, the specific kind of the 1563c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * expression is not reported. 1564c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1565c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedExpr = 100, 15661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1567c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1568c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to some value declaration, such 1569c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * as a function, varible, or enumerator. 1570c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1571c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_DeclRefExpr = 101, 15721efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1573c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1574c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to a member of a struct, union, 1575c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * class, Objective-C class, etc. 1576c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1577c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_MemberRefExpr = 102, 15781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1579c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that calls a function. */ 1580c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_CallExpr = 103, 15811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1582c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that sends a message to an Objective-C 1583c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor object or class. */ 1584c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCMessageExpr = 104, 15851ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 15861ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek /** \brief An expression that represents a block literal. */ 15871ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek CXCursor_BlockExpr = 105, 15881ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 158942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An integer literal. 159042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 159142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IntegerLiteral = 106, 159242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 159342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A floating point number literal. 159442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 159542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_FloatingLiteral = 107, 159642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 159742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An imaginary number literal. 159842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 159942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ImaginaryLiteral = 108, 160042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 160142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A string literal. 160242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 160342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StringLiteral = 109, 160442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 160542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A character literal. 160642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 160742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CharacterLiteral = 110, 160842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 160942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A parenthesized expression, e.g. "(1)". 161042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 161142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This AST node is only formed if full location information is requested. 161242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 161342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ParenExpr = 111, 161442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 161542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This represents the unary-expression's (except sizeof and 161642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * alignof). 161742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 161842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryOperator = 112, 161942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 162042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.1] Array Subscripting. 162142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 162242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ArraySubscriptExpr = 113, 162342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 162442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A builtin binary operation expression such as "x + y" or 162542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "x <= y". 162642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 162742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BinaryOperator = 114, 162842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 162942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Compound assignment such as "+=". 163042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 163142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundAssignOperator = 115, 163242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 163342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The ?: ternary operator. 163442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 163542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ConditionalOperator = 116, 163642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 163742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++ 163842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * (C++ [expr.cast]), which uses the syntax (Type)expr. 163942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 164042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * For example: (int)f. 164142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 164242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CStyleCastExpr = 117, 164342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 164442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.5] 164542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 164642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundLiteralExpr = 118, 164742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 164842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Describes an C or C++ initializer list. 164942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 165042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_InitListExpr = 119, 165142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 165242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The GNU address of label extension, representing &&label. 165342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 165442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_AddrLabelExpr = 120, 165542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 165642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This is the GNU Statement Expression extension: ({int X=4; X;}) 165742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 165842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StmtExpr = 121, 165942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1660ffbe9b9c64ab2e94b9d48ec56e511f75826fc80aBenjamin Kramer /** \brief Represents a C11 generic selection. 166142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 166242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GenericSelectionExpr = 122, 166342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 166442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Implements the GNU __null extension, which is a name for a null 166542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pointer constant that has integral type (e.g., int or long) and is the same 166642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * size and alignment as a pointer. 166742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 166842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * The __null extension is typically only used by system headers, which define 166942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NULL as __null in C++ rather than using 0 (which is an integer that may not 167042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * match the size of a pointer). 167142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 167242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GNUNullExpr = 123, 167342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 167442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s static_cast<> expression. 167542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 167642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXStaticCastExpr = 124, 167742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 167842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s dynamic_cast<> expression. 167942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 168042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDynamicCastExpr = 125, 168142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 168242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s reinterpret_cast<> expression. 168342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 168442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXReinterpretCastExpr = 126, 168542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 168642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s const_cast<> expression. 168742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 168842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXConstCastExpr = 127, 168942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 169042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an explicit C++ type conversion that uses "functional" 169142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * notion (C++ [expr.type.conv]). 169242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 169342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Example: 169442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 169542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * x = int(0.5); 169642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 169742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 169842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXFunctionalCastExpr = 128, 169942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A C++ typeid expression (C++ [expr.typeid]). 170142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 170242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTypeidExpr = 129, 170342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 2.13.5] C++ Boolean Literal. 170542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 170642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXBoolLiteralExpr = 130, 170742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++0x 2.14.7] C++ Pointer Literal. 170942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 171042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNullPtrLiteralExpr = 131, 171142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 171242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents the "this" expression in C++ 171342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 171442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThisExpr = 132, 171542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 171642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 15] C++ Throw Expression. 171742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 171842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This handles 'throw' and 'throw' assignment-expression. When 171942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * assignment-expression isn't present, Op will be null. 172042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 172142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThrowExpr = 133, 172242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 172342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A new expression for memory allocation and constructor calls, e.g: 172442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "new CXXNewExpr(foo)". 172542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 172642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNewExpr = 134, 172742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 172842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A delete expression for memory deallocation and destructor calls, 172942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * e.g. "delete[] pArray". 173042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDeleteExpr = 135, 173242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 173342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A unary expression. 173442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryExpr = 136, 173642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 17379793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C string literal i.e. @"foo". 173842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCStringLiteral = 137, 174042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 17419793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C @encode expression. 174242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 174342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCEncodeExpr = 138, 174442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 17459793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C @selector expression. 174642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 174742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCSelectorExpr = 139, 174842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 17499793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C @protocol expression. 175042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 175142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCProtocolExpr = 140, 175242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 175342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An Objective-C "bridged" cast expression, which casts between 175442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Objective-C pointers and C pointers, transferring ownership in the process. 175542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 175642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 175742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NSString *str = (__bridge_transfer NSString *)CFCreateString(); 175842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 175942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 176042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCBridgedCastExpr = 141, 176142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents a C++0x pack expansion that produces a sequence of 176342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 176442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 176542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * A pack expansion expression contains a pattern (which itself is an 176642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expression) followed by an ellipsis. For example: 176742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 176842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 176942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename F, typename ...Types> 177042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * void forward(F f, Types &&...args) { 177142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * f(static_cast<Types&&>(args)...); 177242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * } 177342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 177442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 177542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_PackExpansionExpr = 142, 177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an expression that computes the length of a parameter 177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pack. 177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename ...Types> 178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * struct count { 178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * static const unsigned value = sizeof...(Types); 178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * }; 178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SizeOfPackExpr = 143, 178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1789011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /* \brief Represents a C++ lambda expression that produces a local function 1790011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * object. 1791011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * 1792011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \code 1793011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * void abssort(float *x, unsigned N) { 1794011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * std::sort(x, x + N, 1795011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * [](float a, float b) { 1796011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * return std::abs(a) < std::abs(b); 1797011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * }); 1798011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * } 1799011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \endcode 1800011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1801011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LambdaExpr = 144, 1802011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1803b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek /** \brief Objective-c Boolean Literal. 1804b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek */ 1805b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek CXCursor_ObjCBoolLiteralExpr = 145, 1806b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek 1807b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek CXCursor_LastExpr = CXCursor_ObjCBoolLiteralExpr, 18081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1809c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Statements */ 1810c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstStmt = 200, 1811c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1812c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A statement whose specific kind is not exposed via this 1813c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * interface. 1814c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1815c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed statements have the same operations as any other kind of 1816c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * statement; one can extract their location information, spelling, 1817c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * children, etc. However, the specific kind of the statement is not 1818c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reported. 1819c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1820c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedStmt = 200, 182136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 182236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** \brief A labelled statement in a function. 182336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 182436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the "start_over:" label statement in 182536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * the following example: 182636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 182736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 182836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 182936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 183036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 183136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 183236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 183336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelStmt = 201, 183442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 183542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A group of statements like { stmt stmt }. 183642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 183742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe compound statements, e.g. function 183842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * bodies. 183942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundStmt = 202, 184142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 184242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A case statment. 184342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CaseStmt = 203, 184542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 184642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A default statement. 184742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DefaultStmt = 204, 184942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An if statement 185142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 185242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IfStmt = 205, 185342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A switch statement. 185542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 185642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SwitchStmt = 206, 185742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A while statement. 185942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 186042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_WhileStmt = 207, 186142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 186242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A do statement. 186342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 186442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DoStmt = 208, 186542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 186642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A for statement. 186742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 186842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ForStmt = 209, 186942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 187042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A goto statement. 187142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 187242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GotoStmt = 210, 187342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 187442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An indirect goto statement. 187542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 187642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IndirectGotoStmt = 211, 187742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 187842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A continue statement. 187942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 188042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ContinueStmt = 212, 188142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 188242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A break statement. 188342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 188442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BreakStmt = 213, 188542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 188642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A return statement. 188742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 188842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ReturnStmt = 214, 188942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 189042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A GNU inline assembly statement extension. 189142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 189242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_AsmStmt = 215, 189342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 18943f54d48a75234efdbbfcd503fd316a78ffd4b50dDouglas Gregor /** \brief Objective-C's overall @try-@catch-@finally statement. 189542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 189642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtTryStmt = 216, 189742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 189842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's @catch statement. 189942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 190042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtCatchStmt = 217, 190142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 190242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's @finally statement. 190342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 190442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtFinallyStmt = 218, 190542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 190642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's @throw statement. 190742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 190842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtThrowStmt = 219, 190942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's @synchronized statement. 191142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtSynchronizedStmt = 220, 191342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's autorelease pool statement. 191542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAutoreleasePoolStmt = 221, 191742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's collection statement. 191942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCForCollectionStmt = 222, 192142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 192242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s catch statement. 192342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXCatchStmt = 223, 192542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 192642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s try statement. 192742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTryStmt = 224, 192942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s for (* : *) statement. 193142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 193242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXForRangeStmt = 225, 193342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's try statement. 193542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 193642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHTryStmt = 226, 193742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's except statement. 193942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHExceptStmt = 227, 194142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 194242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's finally statement. 194342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHFinallyStmt = 228, 194542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 194642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The null satement ";": C99 6.8.3p3. 194742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 194842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe the null statement. 194942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 195042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_NullStmt = 230, 195142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 195242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Adaptor class for mixing declarations with statements and 195342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 195442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 195542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DeclStmt = 231, 195642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 195742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_LastStmt = CXCursor_DeclStmt, 19581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1959c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1960c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Cursor that represents the translation unit itself. 1961c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1962c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor exists primarily to act as the root 1963c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor for traversing the contents of a translation unit. 1964c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1965e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_TranslationUnit = 300, 1966e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 1967e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek /* Attributes */ 1968e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_FirstAttr = 400, 1969e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek /** 1970e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * \brief An attribute whose specific kind is not exposed via this 1971e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * interface. 1972e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek */ 1973e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_UnexposedAttr = 400, 1974e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 1975e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBActionAttr = 401, 1976e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBOutletAttr = 402, 1977857e918a8a40deb128840308a318bf623d68295fTed Kremenek CXCursor_IBOutletCollectionAttr = 403, 19786639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXFinalAttr = 404, 19796639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXOverrideAttr = 405, 19805f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen CXCursor_AnnotateAttr = 406, 198184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCursor_AsmLabelAttr = 407, 198284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCursor_LastAttr = CXCursor_AsmLabelAttr, 19839f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor 19849f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor /* Preprocessing */ 19859f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_PreprocessingDirective = 500, 1986572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor CXCursor_MacroDefinition = 501, 19879b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroExpansion = 502, 19889b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroInstantiation = CXCursor_MacroExpansion, 1989ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor CXCursor_InclusionDirective = 503, 19909f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, 1991ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor CXCursor_LastPreprocessing = CXCursor_InclusionDirective 1992c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 1993c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 1994c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 1995c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for 1996c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit. 1997c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 19981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a 1999c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations, 2000c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations. 2001c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in 2002c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a 2003c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor. 2004c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2005c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways. 2006c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit, 2007c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the 2008c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location 2009c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the 2010c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST. 2011c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2012c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct { 2013c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor enum CXCursorKind kind; 2014aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis int xdata; 2015c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor void *data[3]; 20161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor; 2017c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2018c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2019c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations 2020c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2021c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2022c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 20231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2024c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2025c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity. 2026c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2027c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void); 20281efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2029c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2030c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit. 2031c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2032c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the 2033c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit. 2034c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2035c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); 2036c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2037c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2038c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent. 2039c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2040c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); 20411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2042c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2043b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns non-zero if \arg cursor is null. 2044b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 20455b419362c29b7aa09d9a75a14fe1b11985625bf0Benjamin KramerCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor); 2046b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2047b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 20489ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor. 20499ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */ 20509ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); 20519ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor 20529ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/** 2053c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor. 2054c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2055c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); 2056c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2057c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2058c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration. 2059c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2060c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); 2061c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2062c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2063c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple 2064c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference. 2065c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2066c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to 2067c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a 2068c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity. 2069c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2070c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); 2071c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2072c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2073c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression. 2074c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2075c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); 2076c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2077c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2078c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement. 2079c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2080c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); 2081c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2082c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 20838be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute. 20848be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */ 20858be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); 20868be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor 20878be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/** 20881efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid 2089c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor. 20901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */ 2091c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); 2092c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2093c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 20941efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation 20951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit. 2096c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2097c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); 20981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2099ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/*** 21009f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing 21019f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation. 21029f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */ 21039f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); 21049f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor 21059f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/*** 2106ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently 2107ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). 2108ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */ 2109ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); 2110ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek 2111c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 211216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor. 211316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 211416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind { 211516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This value indicates that no linkage information is available 211616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * for a provided CXCursor. */ 211716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Invalid, 211816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** 211916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief This is the linkage for variables, parameters, and so on that 212016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * have automatic storage. This covers normal (non-extern) local variables. 212116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 212216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_NoLinkage, 212316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for static variables and static functions. */ 212416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Internal, 212516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with external linkage that live 212616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * in C++ anonymous namespaces.*/ 212716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_UniqueExternal, 212816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with true, external linkage. */ 212916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_External 213016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek}; 213116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 213216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 213345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor. 213416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 213516b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); 213616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 213716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 213858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to. 213958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 214058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query. 214158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 214258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor. 214358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 214458ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 214558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor); 214658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 214758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 214845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor. 214945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 215045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind { 21516cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_Invalid = 0, 215245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_C, 215345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_ObjC, 21546cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_CPlusPlus 215545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek}; 215645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 215745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 215845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor. 215945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 216045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); 216145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 2162b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 2163b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from. 2164b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 2165b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); 2166b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2167eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2168eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2169eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief A fast container representing a set of CXCursors. 2170eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2171eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet; 2172eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2173eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2174eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Creates an empty CXCursorSet. 2175eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2176eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(); 2177eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2178eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2179eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory. 2180eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2181eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); 2182eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2183eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2184eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor. 2185eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * 2186eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns non-zero if the set contains the specified cursor. 2187eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/ 2188eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, 2189eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek CXCursor cursor); 2190eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2191eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2192eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet. 2193eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * 2194eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise. 2195eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/ 2196eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, 2197eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek CXCursor cursor); 2198eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 21992be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 22002be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor. 22012be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22022be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains 22032be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents 22042be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by 22052be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or 22062be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 22072be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22082be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 22092be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 22102be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 22112be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 22122be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22132be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 22142be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 22152be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22162be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the 22172be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 22182be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 22192be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the 22202be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 22212be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 22222be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 22232be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 22242be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 22252be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22262be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 22272be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 22282be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 22293910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 22303910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit. 22312be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 22322be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); 22332be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor 22342be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 22352be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor. 22362be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22372be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor 22382be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents 22392be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by 22402be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or 22412be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 22422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 22442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 22452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 22462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 22472be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 22492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 22502be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the 22522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 22532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 22542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the 22552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 22562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 22572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 22582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 22592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 22602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 22612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 22622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 22632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 22643910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 22653910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is 22663910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit. 22672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 22682be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); 22699f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 22709f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 22719f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given 22729f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. 22739f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 22749f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function, 22759f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For 22769f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's 2277044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * base class, its protocols, or its categories' protocols, that has the same 2278044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * selector and is of the same kind (class or instance). 2279044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * If no such method exists, the search continues to the class's superclass, 2280044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * its protocols, and its categories, and so on. A method from an Objective-C 2281044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * implementation is considered to override the same methods as its 2282044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * corresponding method in the interface. 22839f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 22849f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member 22859f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base 22869f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can 22879f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different 22889f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes. 22899f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 22909f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden 22919f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if 22929f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B 22939f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B), 22949f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when 22959f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then 22969f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden 22979f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set. 22989f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 22999f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++ 23009f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this 23019f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides. 23029f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 23039f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a 23049f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden 23059f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be 23069f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to 23079f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors(). 23089f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 23099f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden 23109f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the 23119f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden. 23129f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 23139f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 23149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor CXCursor **overridden, 23159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor unsigned *num_overridden); 23169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 23179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 23189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c 23199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors(). 23209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 23219f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); 23229f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 232345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 2324ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive 2325ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor. 2326ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */ 2327ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); 2328ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor 2329ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/** 2330c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 23321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2333c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2334c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code 2335c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2336c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These 2337c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the 2338c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in 2339c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back. 2340c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2341c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 234250398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */ 23431efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 23446a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/** 2345b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that 2346b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code. 2347b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2348b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation 2349b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that 23501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking 2351b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the 23521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between 2353b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() 2354b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression. 2355b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2356b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or 2357b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found. 23586a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */ 2359b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); 23601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 236198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/** 236298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced 236398258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor. 236498258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * 236598258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that 23661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is 23671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration. 23681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the 236998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code. 237098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */ 237198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); 2372c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2373b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/** 2374b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by 2375a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor. 2376a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * 2377a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the 2378a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and 23791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a 2380a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference, 2381a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced 2382a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used). 2383a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */ 2384a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); 2385c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor 2386c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2387c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2388c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 238995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 2390c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 23918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors 23928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 23938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{ 23948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 23958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 23968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 23978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type 23988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 23998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind { 24008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 24018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Reprents an invalid type (e.g., where no type is available). 24028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 24038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Invalid = 0, 24048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 24068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief A type whose specific kind is not exposed via this 24078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * interface. 24088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 24098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Unexposed = 1, 24108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /* Builtin types */ 24128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Void = 2, 24138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Bool = 3, 24148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_U = 4, 24158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UChar = 5, 24168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char16 = 6, 24178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char32 = 7, 24188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UShort = 8, 24198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt = 9, 24208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULong = 10, 24218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULongLong = 11, 24228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt128 = 12, 24238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_S = 13, 24248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_SChar = 14, 24258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_WChar = 15, 24268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Short = 16, 24278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int = 17, 24288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Long = 18, 24298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongLong = 19, 24308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int128 = 20, 24318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Float = 21, 24328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Double = 22, 24338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongDouble = 23, 24348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_NullPtr = 24, 24358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Overload = 25, 24368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Dependent = 26, 24378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCId = 27, 24388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCClass = 28, 24398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCSel = 29, 24408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_FirstBuiltin = CXType_Void, 24418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LastBuiltin = CXType_ObjCSel, 24428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Complex = 100, 24448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Pointer = 101, 24458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_BlockPointer = 102, 24468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LValueReference = 103, 24478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_RValueReference = 104, 24488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Record = 105, 24498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Enum = 106, 24508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Typedef = 107, 24518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCInterface = 108, 245204c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_ObjCObjectPointer = 109, 245304c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_FunctionNoProto = 110, 24545f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis CXType_FunctionProto = 111, 245584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXType_ConstantArray = 112, 245684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXType_Vector = 113 24578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek}; 24588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 246084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type 246184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 246284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv { 246384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Default = 0, 246484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_C = 1, 246584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86StdCall = 2, 246684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86FastCall = 3, 246784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86ThisCall = 4, 246884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86Pascal = 5, 246984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS = 6, 247084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS_VFP = 7, 247184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 247284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Invalid = 100, 247384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Unexposed = 200 247484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis}; 247584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 247684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 247784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 24788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree. 24798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 24808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 24818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct { 24828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek enum CXTypeKind kind; 24838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek void *data[2]; 24848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType; 24858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 24878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any). 24888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 24898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); 24908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 24918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 249284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration. 249384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 249484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is 249584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 249684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 249784b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); 249884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 249984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 250084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration. 250184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 250284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is 250384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 250484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 250584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); 250684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 250784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 250884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed 250984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 251084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 251184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. 251284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 251384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 251484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 251584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); 251684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 251784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 251884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned 251984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 252084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 252184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. 252284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 252384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 252484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 252584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); 252684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 252784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 25288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \determine Determine whether two CXTypes represent the same type. 25298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 25308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \returns non-zero if the CXTypes represent the same type and 25318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek zero otherwise. 25328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); 25348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 25368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType. 25378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 25388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways 25398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented. The canonical type is the underlying 25408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed. For example, if 'T' is a typedef 25418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'. 25428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); 25448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 2546e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * \determine Determine whether a CXType has the "const" qualifier set, 2547e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * without looking through typedefs that may have added "const" at a different level. 2548e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2549e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); 2550e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2551e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 2552e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * \determine Determine whether a CXType has the "volatile" qualifier set, 2553e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * without looking through typedefs that may have added "volatile" at a different level. 2554e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2555e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); 2556e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2557e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 2558e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * \determine Determine whether a CXType has the "restrict" qualifier set, 2559e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor * without looking through typedefs that may have added "restrict" at a different level. 2560e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2561e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); 2562e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2563e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 25648e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee. 25658e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 25668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T); 25688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 25708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type. 25718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); 25738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25745389f48b24937ad7b4093307128b3cbf25235654David Chisnall/** 25755389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration. 25765389f48b24937ad7b4093307128b3cbf25235654David Chisnall */ 25775389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); 25788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 25808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind. 25818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); 25838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 258584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type. 258684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 258784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned. 258884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 258984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); 259084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 259184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 25929a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type. 259384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 259484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned. 259504c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */ 259604c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T); 259704c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek 259804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/** 259984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a function type. 260084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 260184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, UINT_MAX is returned. 260284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 260384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_getNumArgTypes(CXType T); 260484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 260584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 260684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the type of an argument of a function type. 260784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 260884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in or the function does not have enough parameters, 260984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned. 261084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 261184b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); 261284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 261384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 261484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise. 261584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 261684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 261784b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); 261884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 261984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 262084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the result type associated with a given cursor. 262184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 262284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method. 26239a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */ 26249a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); 26259a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek 26269a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/** 26273ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0 26283ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * otherwise. 26293ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */ 26303ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T); 26313ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek 26323ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/** 263384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type. 263484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 263584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type, 263684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned. 263784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 263884b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T); 263984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 264084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 264184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type. 264284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 264384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type, 264484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned. 264584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 264684b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T); 264784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 264884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 26495f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type. 26505f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 26515f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned. 26525f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 26535f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); 26545f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 26555f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 26565f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the the array size of a constant array. 26575f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 26585f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned. 26595f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 26605f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T); 26615f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 26625f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 26633064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind 26643064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * CX_CXXBaseSpecifier is virtual. 26653064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 26663064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); 26673064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 26683064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 26693064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a 26703064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier. 26713064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 26723064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier { 26733064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXInvalidAccessSpecifier, 26743064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPublic, 26753064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXProtected, 26763064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPrivate 26773064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek}; 26783064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 26793064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 26803064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns the access control level for the C++ base specifier 26812dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * represented by a cursor with kind CXCursor_CXXBaseSpecifier or 26822dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * CXCursor_AccessSpecifier. 26833064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 26843064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); 26853064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 26863064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 26871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a 26881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor. 26891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 26901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 26911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 26921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it 26931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. 26941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 26951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); 26961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 26971f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 26981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced 26991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor. 27001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 27011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 27021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 27031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in 27041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor. 27051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 27061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given 27071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an 27081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds, 27091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor(); 27101f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 27111f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 27121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor unsigned index); 27131f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 27141f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 27158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @} 27168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 271795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 271895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 2719ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes 272095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 272195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{ 272295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 272395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 272495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 272595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 272695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute, 272795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * this function returns the collection element type. 272895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 272995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 273095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); 273195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 273295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 273395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @} 273495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 27358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 2737c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors 2738c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2739c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree 2740c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors. 2741c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2742c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2743c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 27441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2745c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2746c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular 2747c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor. 2748c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2749c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each 2750c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. 2751c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2752c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult { 2753c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 27541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Terminates the cursor traversal. 2755c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2756c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Break, 27571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 2758c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Continues the cursor traversal with the next sibling of 2759c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the cursor just visited, without visiting its children. 2760c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2761c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Continue, 2762c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 2763c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Recursively traverse the children of this cursor, using 2764c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the same visitor and client data. 2765c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2766c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Recurse 2767c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 2768c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2769c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2770c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal. 2771c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2772c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by 2773c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being 2774c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor, 2775c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to 2776c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). 2777c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2778c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values 2779c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren(). 2780c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 27811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, 27821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor parent, 2783c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 2784c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2785c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2786c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor. 2787c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2788c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor, 2789c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each 2790c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns 2791c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if 2792c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break. 2793c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2794c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of 2795a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by 2796c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children). 2797c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2798c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each 2799c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent. 2800c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2801c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will 2802c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked. 2803c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2804c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated 2805c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break. 2806c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 28071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, 2808c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursorVisitor visitor, 2809c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 28103387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature 28113387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# if __has_feature(blocks) 28123387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 28133387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal. 28143387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 28153387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by 28163387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being 28173387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor. 28183387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 28193387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values 28203387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock(). 28213387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 28223387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult 28233387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); 28243387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall 28253387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 28263387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block. Behaves 28273387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects. 28283387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 28293387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent, 28303387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall CXCursorVisitorBlock block); 28313387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# endif 28323387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif 28331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2834c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2835c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2836c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 28371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2838c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2839c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST 2840c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 28411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and 2842c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced 2843c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference, 2844c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions. 2845c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2846c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2847c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 28481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2849c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2850c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced 2851c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor. 2852c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2853c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular 2854c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be 2855c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in 2856c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit. 2857c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2858c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); 2859c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2860c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2861896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class. 2862896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2863896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); 2864896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2865896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2866896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category. 2867896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2868896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 286966ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek clang_constructUSR_ObjCCategory(const char *class_name, 2870896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek const char *category_name); 2871896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2872896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2873896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol. 2874896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2875896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 2876896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek clang_constructUSR_ObjCProtocol(const char *protocol_name); 2877896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2878896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2879896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2880896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and 2881896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 2882896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2883896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, 2884896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 2885896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2886896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2887896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and 2888896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 2889896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2890896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, 2891896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek unsigned isInstanceMethod, 2892896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 2893896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2894896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2895896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR 2896896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * for its containing class. 2897896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 2898896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, 2899896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 2900896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2901896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 2902c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor. 2903c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2904c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); 2905c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2906358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/** 2907ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \brief Retrieve a range for a piece that forms the cursors spelling name. 2908ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * Most of the times there is only one range for the complete spelling but for 2909ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * objc methods and objc message expressions, there are multiple pieces for each 2910ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * selector identifier. 2911ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 2912ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param pieceIndex the index of the spelling name piece. If this is greater 2913ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * than the actual number of pieces, it will return a NULL (invalid) range. 2914ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 2915ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param options Reserved. 2916ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis */ 2917ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios KyrtzidisCINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, 2918ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned pieceIndex, 2919ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned options); 2920ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis 2921ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis/** 2922358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor. 2923358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * 2924358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor, 2925358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a 2926358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization. 2927358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */ 2928358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); 2929358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor 2930c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the 2931c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references. 2932c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * 2933c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an 2934c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class. 29351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the 2936c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or 2937c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged. 29381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor. 2939c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */ 2940c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); 2941b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 29421efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 2943b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief For a cursor that is either a reference to or a declaration 2944b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * of some entity, retrieve a cursor that describes the definition of 2945b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that entity. 2946b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 2947b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * Some entities can be declared multiple times within a translation 2948b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * unit, but only one of those declarations can also be a 2949b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * definition. For example, given: 2950b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 2951b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \code 2952b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 2953b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int g(int x, int y) { return f(x, y); } 2954b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int a, int b) { return a + b; } 2955b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 2956b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \endcode 2957b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 2958b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * there are three declarations of the function "f", but only the 2959b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * second one is a definition. The clang_getCursorDefinition() 2960b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * function will take any cursor pointing to a declaration of "f" 2961b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * (the first or fourth lines of the example) or a cursor referenced 2962b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that uses "f" (the call to "f' inside "g") and will return a 2963b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration cursor pointing to the definition (the second "f" 2964b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration). 2965b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 2966b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * If given a cursor for which there is no corresponding definition, 2967b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * e.g., because there is no definition of that entity within this 2968b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * translation unit, returns a NULL cursor. 2969b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 2970b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); 2971b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 29721efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 2973b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor 2974b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity. 2975b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 2976b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); 2977b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 2978c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 29791a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor. 29801a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 29811a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several 29821a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can 29831a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined: 29841a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 29851a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code 29861a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 29871a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 29881a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X { 29891a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * int member; 29901a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * }; 29911a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode 29921a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 29931a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three 29941a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying 29951a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which 29961a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can 29971a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by 29981a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors. 29991a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 30001a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor. 30011a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */ 30021a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); 30031a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor 30041a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/** 3005c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3006c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 30071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3008c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 30099ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection 30109ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 30119ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific 30129ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features. 30139ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 30149ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{ 30159ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 30169ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 30179ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 301849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is 301949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'. 30209ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 30219ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); 30229ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 30239ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 3024211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is 3025211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from 3026211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes. 3027211924b563aa31421836cee7655be729ad02733fDouglas Gregor */ 3028211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); 3029211924b563aa31421836cee7655be729ad02733fDouglas Gregor 3030211924b563aa31421836cee7655be729ad02733fDouglas Gregor/** 303149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine 303249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating 303349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template. 303449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 303549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template, 303649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the 303749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is 303849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union". 303949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 304049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template 304149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration. 304249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 304349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated 304449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns 304549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound. 304649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */ 304749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); 304849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor 304949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/** 3050e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation 3051e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it 3052e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated. 3053e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3054e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit 3055e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template, 3056e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template 3057e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return 3058e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was 3059e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template 3060e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a 3061e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this 3062e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template. 3063e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3064e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or 3065e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member. 3066e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class 3067e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that 3068e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly. 3069e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3070e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member 3071e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template. 3072e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3073e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a 3074e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or 3075e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor. 3076e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */ 3077e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); 3078430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3079430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/** 3080430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range 3081430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference. 3082430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3083430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or 3084430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call. 3085430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags: 3086430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and 3087430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece. 3088430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag 3089430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is 3090430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a 3091430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * non-contiguous names, this index can be used to retreive the individual 3092430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece. 3093430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3094430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no 3095430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. 3096430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 309748a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, 309848a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet unsigned NameFlags, 3099430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor unsigned PieceIndex); 3100430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3101430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags { 3102430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3103430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the 3104430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * range. 3105430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3106430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantQualifier = 0x1, 3107430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3108430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3109430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Include the explicit template arguments, e.g. <int> in x.f<int>, in 3110430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * the range. 3111430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3112430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantTemplateArgs = 0x2, 3113430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3114430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3115430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief If the name is non-contiguous, return the full spanning range. 3116430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3117430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * Non-contiguous names occur in Objective-C when a selector with two or more 3118430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * parameters is used, or in C++ when using an operator: 3119430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \code 3120430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * [object doSomething:here withValue:there]; // ObjC 3121430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * return some_vector[1]; // C++ 3122430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \endcode 3123430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3124430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantSinglePiece = 0x4 3125430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor}; 3126e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor 3127e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/** 31289ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @} 31299ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 31309ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 31319ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 31320045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation 31330045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 31340045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a 31350045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to 31360045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors. 3137fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3138fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{ 3139fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3140fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3141fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3142fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token. 3143fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3144fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind { 3145fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3146fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A token that contains some kind of punctuation. 3147fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3148fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Punctuation, 3149896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3150fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 31510045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \brief A language keyword. 3152fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3153fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Keyword, 3154896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3155fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3156fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief An identifier (that is not a keyword). 3157fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3158fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Identifier, 3159896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3160fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3161fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A numeric, string, or character literal. 3162fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3163fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Literal, 3164896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3165fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3166fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A comment. 3167fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3168fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Comment 3169fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind; 3170fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3171fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3172fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token. 3173fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3174fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct { 3175fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor unsigned int_data[4]; 3176fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor void *ptr_data; 3177fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken; 3178fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3179fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3180fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token. 3181fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3182fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); 3183896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3184fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3185fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token. 3186fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3187fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g., 3188fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword. 3189fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3190fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); 3191896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3192fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3193fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token. 3194fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3195896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, 3196fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken); 3197896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3198fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3199fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token. 3200fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3201fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); 3202fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3203fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3204fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw 3205fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens. 3206fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3207fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized. 3208fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3209fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the 3210fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range, 3211fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3212fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens 3213fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be 3214fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed. 3215fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3216fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens 3217fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array. 3218fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3219fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3220fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, 3221fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken **Tokens, unsigned *NumTokens); 3222896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3223fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3224fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token 3225fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree. 3226fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 32270045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking 32280045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the 32290045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those 32300045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are 32310045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x), 32320045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors: 32330045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 32340045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. 32350045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. 32360045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. 32370045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 32380045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the 32390045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function 32400045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small 32410045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is 32420045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation. 3243fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3244fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens. 3245fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3246fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate. 3247fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3248fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens. 3249fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3250fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be 3251fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token. 3252fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3253fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, 3254fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens, 3255fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXCursor *Cursors); 3256896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3257fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3258fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens. 3259fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3260896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, 3261fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens); 3262896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3263fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3264fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @} 3265fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3266896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3267fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3268c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities 3269c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3270c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not 3271c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon. 3272c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3273c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3274c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 32751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 32764ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */ 3277e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); 32781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, 32791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar const char **startBuf, 32804ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff const char **endBuf, 32814ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startLine, 32824ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startColumn, 32834ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endLine, 32844ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endColumn); 32850a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void); 3286995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, 3287995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar unsigned stack_size); 3288995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar 32890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 3290c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3291c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 32921efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3293c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3294c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion 3295c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3296c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with 3297c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting 3298c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to 3299c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and 3300c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion. 3301c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3302c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3303c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 33041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3305c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 33060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result. 33070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion 33090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the 33100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected. 33110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which 33120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g., 33130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of 33140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace 33150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a 33161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks. 33170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString; 33191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 33200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 33210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion. 33220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct { 33240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 33251efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief The kind of entity that this completion refers to. 33260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor kind will be a macro, keyword, or a declaration (one of the 33280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * *Decl cursor kinds), describing the entity that the completion is 33290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to. 33300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \todo In the future, we would like to provide a full cursor, to allow 33320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the client to extract additional information from declaration. 33330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor enum CXCursorKind CursorKind; 33351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 33361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 33370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief The code-completion string that describes how to insert this 33380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion result into the editing buffer. 33390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionString CompletionString; 33410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult; 33420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 33430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 33440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string. 33450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is 33471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text 33480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string. 33490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind { 33510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 33520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A code-completion string that describes "optional" text that 33530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * could be a part of the template (but is not required). 33540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The Optional chunk is the only kind of chunk that has a code-completion 33561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * string for its representation, which is accessible via 33570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \c clang_getCompletionChunkCompletionString(). The code-completion string 33580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * describes an additional part of the template that is completely optional. 33590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * For example, optional chunks can be used to describe the placeholders for 33600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * arguments that match up with defaulted function parameters, e.g. given: 33610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 33630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * void f(int x, float y = 3.14, double z = 2.71828); 33640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 33650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The code-completion string for this function would contain: 33670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a TypedText chunk for "f". 33680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a LeftParen chunk for "(". 33690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "int x" 33700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the remaining defaulted arguments, e.g., 33710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 337271570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * - a Placeholder chunk for "float y" 33730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the last defaulted argument: 33740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 33750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "double z" 33760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a RightParen chunk for ")" 33770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 337871570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * There are many ways to handle Optional chunks. Two simple approaches are: 33790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Completely ignore optional chunks, in which case the template for the 33800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would only include the first parameter ("int x"). 33810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Fully expand all optional chunks, in which case the template for the 33820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would have all of the parameters. 33830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Optional, 33850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 33860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that a user would be expected to type to get this 33871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * code-completion result. 33880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * There will be exactly one "typed text" chunk in a semantic string, which 33901efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * will typically provide the spelling of a keyword or the name of a 33910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * declaration that could be used at the current code point. Clients are 33920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * expected to filter the code-completion results based on the text in this 33930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * chunk. 33940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 33950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_TypedText, 33960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 33970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that should be inserted as part of a code-completion result. 33980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 33990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "text" chunk represents text that is part of the template to be 34000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * inserted into user code should this particular code-completion result 34010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * be selected. 34020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Text, 34040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Placeholder text that should be replaced by the user. 34060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 34070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "placeholder" chunk marks a place where the user should insert text 34080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * into the code-completion template. For example, placeholders might mark 34090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the function parameters for a function declaration, to indicate that the 34100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * user should provide arguments for each of those parameters. The actual 34110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * text in a placeholder is a suggestion for the text to display before 34120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the user replaces the placeholder with real code. 34130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Placeholder, 34150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Informative text that should be displayed but never inserted as 34170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * part of the template. 34181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 34190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * An "informative" chunk contains annotations that can be displayed to 34200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * help the user decide whether a particular code-completion result is the 34210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * right option, but which is not part of the actual template to be inserted 34220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * by code completion. 34230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Informative, 34250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that describes the current parameter when code-completion is 34270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to function call, message send, or template specialization. 34280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 34290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "current parameter" chunk occurs when code-completion is providing 34300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * information about a parameter corresponding to the argument at the 34310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion point. For example, given a function 34320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 34330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 34340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * int add(int x, int y); 34350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 34360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 34370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * and the source code \c add(, where the code-completion point is after the 34380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "(", the code-completion string will contain a "current parameter" chunk 34390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * for "int x", indicating that the current argument will initialize that 34400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * parameter. After typing further, to \c add(17, (where the code-completion 34411efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * point is after the ","), the code-completion string will contain a 34420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "current paremeter" chunk to "int y". 34430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_CurrentParameter, 34450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left parenthesis ('('), used to initiate a function call or 34470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the beginning of a function parameter list. 34480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftParen, 34500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right parenthesis (')'), used to finish a function call or 34520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the end of a function parameter list. 34530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightParen, 34550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left bracket ('['). 34570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBracket, 34590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right bracket (']'). 34610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBracket, 34630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left brace ('{'). 34650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBrace, 34670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right brace ('}'). 34690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBrace, 34710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left angle bracket ('<'). 34730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftAngle, 34750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right angle bracket ('>'). 34770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 34780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightAngle, 34790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 34800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A comma separator (','). 34810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 3482ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor CXCompletionChunk_Comma, 3483ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor /** 34841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Text that specifies the result type of a given result. 3485ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * 3486ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * This special kind of informative chunk is not meant to be inserted into 34871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the text buffer. Rather, it is meant to illustrate the type that an 3488ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * expression using the given completion string would have. 3489ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor */ 349001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_ResultType, 349101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 349201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A colon (':'). 349301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 349401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Colon, 349501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 349601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A semicolon (';'). 349701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 349801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_SemiColon, 349901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 350001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief An '=' sign. 350101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 350201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Equal, 350301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 350401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Horizontal space (' '). 350501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 350601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_HorizontalSpace, 350701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 350801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Vertical space ('\n'), after which it is generally a good idea to 350901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * perform indentation. 351001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 351101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_VerticalSpace 35120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor}; 35131efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 35140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 35150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string. 35160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 35180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 35200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number. 35220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 35231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind 35240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string, 35250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 35261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 35270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 35281efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a 35290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string. 35300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 35320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 35340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number. 35360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 35372ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString 35380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string, 35390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 35400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 35410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 35421efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk 35430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string. 35440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 35460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 35480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 35490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index 35506164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number. 35510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 35520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString 35530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string, 35540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 35551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 35560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 35570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string. 35580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 35590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned 35600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string); 35610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 35620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 356312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion. 356412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 356512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this 356612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The 356712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics. 356812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 356912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query. 357012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 357112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate 357212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions. 357312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */ 357412e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned 357512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string); 357612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor 357712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/** 357858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion 357958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to. 358058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 358158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query. 358258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 358358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string. 358458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 358558ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 358658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string); 358758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 358858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 35896164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given 35906164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 35916164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 35926164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 35936164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 35946164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion 35956164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string. 35966164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 35976164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned 35986164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string); 35996164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 36006164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 36016164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string. 36026164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 36036164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 36046164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 36056164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the 36066164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 36076164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 36086164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index 36096164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available. 36106164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 36116164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString 36126164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string, 36136164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen unsigned annotation_number); 36146164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 36156164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 3616ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \brief Retrieve the parent context of the given completion string. 3617ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 3618ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * The parent context of a completion string is the semantic parent of 3619ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the declaration (if any) that the code completion represents. For example, 3620ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * a code completion for an Objective-C method would have the method's class 3621ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or protocol as its context. 3622ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 3623ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param completion_string The code completion string whose parent is 3624ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * being queried. 3625ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 3626ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param kind If non-NULL, will be set to the kind of the parent context, 3627ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or CXCursor_NotImplemented if there is no context. 3628ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 3629ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param Returns the name of the completion parent, e.g., "NSObject" if 3630ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the completion string represents a method in the NSObject class. 3631ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor */ 3632ba1030698dbc276db86b11c5329a1edee8a1805eDouglas GregorCINDEX_LINKAGE CXString 3633ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregorclang_getCompletionParent(CXCompletionString completion_string, 3634ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor enum CXCursorKind *kind); 3635ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor/** 36368fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro 36378fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor. 36388fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 36398fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query. 36408fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 36418fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro 36428fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors. 36438fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */ 36448fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString 36458fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor); 36468fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor 36478fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/** 3648ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion. 3649ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * 3650ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as 3651e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by 3652ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults. 3653ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 3654ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct { 3655ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 3656ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The code-completion results. 3657ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 3658ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor CXCompletionResult *Results; 3659ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 3660ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 3661ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The number of code-completion results stored in the 3662ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c Results array. 3663ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 3664ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor unsigned NumResults; 3665ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults; 3666ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 3667ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/** 3668cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to 3669cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior. 3670cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 3671cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to 3672cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt(). 3673cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 3674cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags { 3675cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 3676cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include macros within the set of code 3677cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completions returned. 3678cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 3679cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor CXCodeComplete_IncludeMacros = 0x01, 3680cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 3681cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 3682cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include code patterns for language constructs 3683cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * within the set of code completions, e.g., for loops. 3684cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 3685cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor CXCodeComplete_IncludeCodePatterns = 0x02 3686cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor}; 3687cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 3688cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 36893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring. 36903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 36913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple 36923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously. 36933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 36943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext { 36953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 36963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The context for completions is unexposed, as only Clang results 36973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included. (This is equivalent to having no context bits set.) 36983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 36993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unexposed = 0, 37003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible type should be included in the results. 37033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyType = 1 << 0, 37053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible value (variables, function calls, etc.) 37083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 37093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyValue = 1 << 1, 37113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C object should 37133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * be included in the results. 37143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCObjectValue = 1 << 2, 37163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C selector 37183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 37193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorValue = 1 << 3, 37213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to a C++ class type should be 37233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 37243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_CXXClassTypeValue = 1 << 4, 37263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the dot 37293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 37303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_DotMemberAccess = 1 << 5, 37323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the arrow 37343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 37353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ArrowMemberAccess = 1 << 6, 37373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for properties of the Objective-C object being accessed 37393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * using the dot operator should be included in the results. 37403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCPropertyAccess = 1 << 7, 37423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for enum tags should be included in the results. 37453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_EnumTag = 1 << 8, 37473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for union tags should be included in the results. 37493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_UnionTag = 1 << 9, 37513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for struct tags should be included in the results. 37533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_StructTag = 1 << 10, 37553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ class names should be included in the results. 37583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ClassTag = 1 << 11, 37603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ namespaces and namespace aliases should be 37623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 37633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Namespace = 1 << 12, 37653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ nested name specifiers should be included in 37673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 37683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NestedNameSpecifier = 1 << 13, 37703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 37713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C interfaces (classes) should be included 37733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 37743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInterface = 1 << 14, 37763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C protocols should be included in 37783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 37793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCProtocol = 1 << 15, 37813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C categories should be included in 37833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 37843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCCategory = 1 << 16, 37863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C instance messages should be included 37883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 37893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInstanceMessage = 1 << 17, 37913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C class messages should be included in 37933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 37943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 37953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCClassMessage = 1 << 18, 37963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 37973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C selector names should be included in 37983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 37993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 38003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorName = 1 << 19, 38013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 38023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 38033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for preprocessor macro names should be included in 38043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 38053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 38063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_MacroName = 1 << 20, 38073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 38083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 38093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Natural language completions should be included in the results. 38103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 38113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NaturalLanguage = 1 << 21, 38123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 38133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 38143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The current context is unknown, so set all contexts. 38153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 38163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unknown = ((1 << 22) - 1) 38173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor}; 38183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 38193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 3820cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be 3821cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt(). 3822cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 3823cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); 3824cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 3825cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 38261abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit. 38271abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38281abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and 38291abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential 38301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model 38311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file, 38321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has 38331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed 38341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the 38351abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of 38361abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are 38371abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure. 38381abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38391abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the 38401abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the 38411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p 38421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then 38431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">", 38441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that 38451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the 38461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results 38471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for 38481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after 38491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 38501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only 38511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface 38521abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion 38531abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must 38541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency. 38551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38561abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should 38571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be 38581abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may 38591abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the 38601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation. 38611abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38621abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code 38631abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file 38641abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit. 38651abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38661abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur. 38671abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38681abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur. 38691abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that 38701abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token. 38711abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38721abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk 38731abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the 38741abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files. The contents and name of these files (as 38751abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the 38761abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to 38771abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns. 38781abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 38791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 38801abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files. 38811abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 3882cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code 3883cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the 3884cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The 3885cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set 3886cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options. 3887cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 38881abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure 38891abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be 38901abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code 38911abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL. 38921abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */ 38931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE 38941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, 38951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor const char *complete_filename, 38961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_line, 38971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_column, 38981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor struct CXUnsavedFile *unsaved_files, 3899cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned num_unsaved_files, 3900cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned options); 39011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor 39021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/** 39031e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical 39041e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order. 39051e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * 39061e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort. 39071e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results. 39081e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */ 39091e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE 39101e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results, 39111e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor unsigned NumResults); 39121e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor 39131e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/** 3914ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results. 39150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 39161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE 3917ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); 391858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 391920d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/** 3920a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the 3921a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed. 3922a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 3923896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 3924a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); 3925a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 3926a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 3927a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion. 3928a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 3929a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Result the code completion results to query. 3930a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 3931a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 3932a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 3933a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 3934a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 3935896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 3936a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, 3937a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 3938a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 3939a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 39403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context 39413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion. 39423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 39433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query 39443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 39453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use 39463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results. 39473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 39483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE 39493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts( 39503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCodeCompleteResults *Results); 3951e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 3952e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 3953e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code 3954e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for 3955e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C 3956e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return 3957e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode. 3958e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 3959e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 3960e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 3961e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete 3962e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete 3963e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true. 3964e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 3965e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a 3966e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container 3967e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 3968e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 3969e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind( 3970e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor CXCodeCompleteResults *Results, 3971e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor unsigned *IsIncomplete); 3972e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 3973e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 3974e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion 3975e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this 3976e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string. 3977e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 3978e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 3979e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 3980e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container 3981e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 3982e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 3983e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); 39843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 39850a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 39860a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/** 39870a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message 39880a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a 39890a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and 39900a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage. 39910a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 39920a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query 39930a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 39940a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far 39950a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send. 39960a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */ 39970a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE 39980a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); 39990a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 40003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 400120d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @} 400220d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */ 40031efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 40041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 400504bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/** 400604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions 400704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * 400804bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{ 400904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 401023e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek 401123e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/** 401223e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not 401323e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * intended to be parsed (the format is not guaranteed to be stable). 401423e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */ 4015a2a9d6e4e5b6001b86b7dfc5db1ea296ce29a3d3Ted KremenekCINDEX_LINKAGE CXString clang_getClangVersion(); 401604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek 4017d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 4018d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/** 4019d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery. 4020d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * 4021d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \param Flag to indicate if crash recovery is enabled. A non-zero value 4022d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * enables crash recovery, while 0 disables it. 4023d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */ 4024d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); 4025d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 402616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /** 4027896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Visitor invoked for each file in a translation unit 402816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * (used with clang_getInclusions()). 402916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * 403016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * This visitor function will be invoked by clang_getInclusions() for each 403116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * file included (either at the top-level or by #include directives) within 403216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * a translation unit. The first argument is the file being included, and 403316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the second and third arguments provide the inclusion stack. The 403416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * array is sorted in order of immediate inclusion. For example, 403516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the first element refers to the location that included 'included_file'. 403616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 403716b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file, 403816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXSourceLocation* inclusion_stack, 403916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek unsigned include_len, 404016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 404116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 404216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 404316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit. 404416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * The visitor function is called with the provided data for every included 404516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * file. This does not include headers included by the PCH file (unless one 404616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * is inspecting the inclusions in the PCH file itself). 404716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 404816b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, 404916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXInclusionVisitor visitor, 405016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 405116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 405216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 405304bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @} 405404bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 40551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 405697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions 405797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 405897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{ 405997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 406097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 406197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 406297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files. 406397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 406497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping; 406597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 406697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 406797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping. 406897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 406997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings. 407097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 407197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed 407297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 407397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 407497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); 407597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 407697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 407730660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \brief Retrieve a remapping. 407830660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 407930660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param filePaths pointer to an array of file paths containing remapping info. 408030660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 408130660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param numFiles number of file paths. 408230660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 408330660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \returns the requested remapping. This remapping must be freed 408430660a898545416f0fea2d717f16f75640001e38Ted Kremenek * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 408530660a898545416f0fea2d717f16f75640001e38Ted Kremenek */ 408630660a898545416f0fea2d717f16f75640001e38Ted KremenekCINDEX_LINKAGE 408730660a898545416f0fea2d717f16f75640001e38Ted KremenekCXRemapping clang_getRemappingsFromFileList(const char **filePaths, 408830660a898545416f0fea2d717f16f75640001e38Ted Kremenek unsigned numFiles); 408930660a898545416f0fea2d717f16f75640001e38Ted Kremenek 409030660a898545416f0fea2d717f16f75640001e38Ted Kremenek/** 409197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings. 409297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 409397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); 409497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 409597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 409697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping. 409797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 409897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename. 409997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 410097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original 410197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with. 410297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 410397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, 410497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis CXString *original, CXString *transformed); 410597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 410697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 410797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping. 410897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 410997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping); 411097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 411197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 411297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @} 411397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 411497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 4115aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions 4116aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4117aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{ 4118aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4119aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4120aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult { 4121aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Break, 4122aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Continue 4123aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis}; 4124aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4125aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct { 4126aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis void *context; 4127aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); 4128aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor; 4129aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4130aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 4131aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file. 4132aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4133aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one. 4134aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4135aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references. 4136aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4137aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 4138aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found. 4139aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside 4140aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid. 4141aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4142aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE void clang_findReferencesInFile(CXCursor cursor, CXFile file, 4143aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXCursorAndRangeVisitor visitor); 4144aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4145aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature 4146aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# if __has_feature(blocks) 4147aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4148aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult 4149aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); 4150aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4151aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE 4152aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisvoid clang_findReferencesInFileWithBlock(CXCursor, CXFile, 4153aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXCursorAndRangeVisitorBlock); 4154aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4155aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# endif 4156aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif 4157aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4158bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4159bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile. 4160bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4161dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile; 4162bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 4163bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 41642957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity. 41652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 41662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity; 41672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 41682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 4169bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container 4170bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities. 4171bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4172dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer; 4173bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 4174bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4175bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH 4176bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module). 4177bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4178dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile; 41794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4180bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4181dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks. 4182bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 41834e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 41844e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void *ptr_data[2]; 41854e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned int_data; 41864e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc; 41874e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4188bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4189bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see ppIncludedFile callback. 4190bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 41914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 4192bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4193bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Location of '#' in the #include/#import directive. 4194bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 41954e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc hashLoc; 4196bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4197bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Filename as written in the #include/#import directive. 4198bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 41994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *filename; 4200bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4201bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The actual file that the #include/#import directive resolved to. 4202bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4203dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXFile file; 42044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isImport; 42054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isAngled; 42064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo; 42074e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4208bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4209bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see importedASTFile callback. 4210bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 42114e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 42124e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile file; 4213bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4214bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Location where the file is imported. It is useful mostly for 4215bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * modules. 4216bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 42174e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 4218bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4219bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Non-zero if the AST file is a module otherwise it's a PCH. 4220bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 42214e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isModule; 42224e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo; 42234e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4224dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 4225dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Unexposed = 0, 4226dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Typedef = 1, 4227dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Function = 2, 4228dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Variable = 3, 4229dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Field = 4, 4230dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_EnumConstant = 5, 42314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4232dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCClass = 6, 4233dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCProtocol = 7, 4234dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCCategory = 8, 42354e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4236c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCInstanceMethod = 9, 4237c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCClassMethod = 10, 4238c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCProperty = 11, 4239c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCIvar = 12, 42404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4241c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Enum = 13, 4242c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Struct = 14, 4243c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Union = 15, 42442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 42452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXClass = 16, 42462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespace = 17, 42472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespaceAlias = 18, 42482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticVariable = 19, 42492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticMethod = 20, 42502957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXInstanceMethod = 21, 42512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXConstructor = 22, 42522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXDestructor = 23, 42532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXConversionFunction = 24, 4254838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntity_CXXTypeAlias = 25 42554e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4256dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxEntityKind; 42574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4258838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum { 4259838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_None = 0, 4260838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_C = 1, 4261838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_ObjC = 2, 4262838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_CXX = 3 4263838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage; 4264838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis 42652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 42662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to: 42672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function 42682957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass 42692957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod 42702957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod 42712957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor 42722957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction 42732957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias 42742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 42752957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum { 42762957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_NonTemplate = 0, 42772957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_Template = 1, 42782957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplatePartialSpecialization = 2, 42792957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplateSpecialization = 3 42802957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind; 42812957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 4282b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum { 4283b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_Unexposed = 0, 4284b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBAction = 1, 4285b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutlet = 2, 4286b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutletCollection = 3 4287b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind; 4288b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 4289b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 4290b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttrKind kind; 4291b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor cursor; 4292b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc loc; 4293b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo; 4294b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 4295b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 4296643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityKind kind; 4297643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityCXXTemplateKind templateKind; 4298643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityLanguage lang; 4299643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *name; 4300643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *USR; 4301643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 4302643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 4303643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis unsigned numAttributes; 4304643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo; 4305643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 4306643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 4307643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 4308643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo; 4309643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 4310643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 4311b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *attrInfo; 4312b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 4313b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor classCursor; 4314b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc classLoc; 4315b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo; 4316b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 43174e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 43186ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *entityInfo; 4319dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXCursor cursor; 4320dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxLoc loc; 4321b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *semanticContainer; 4322b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis /** 4323b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis * \brief Generally same as \see semanticContainer but can be different in 4324b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis * cases like out-of-line C++ member functions. 4325b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis */ 4326b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *lexicalContainer; 4327dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis int isRedeclaration; 43284e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isDefinition; 4329c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isContainer; 43302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *declAsContainer; 4331c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis /** 4332c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis * \brief Whether the declaration exists in code or was created implicitly 4333c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis * by the compiler, e.g. implicit objc methods for properties. 4334c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis */ 4335c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isImplicit; 4336b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 4337b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis unsigned numAttributes; 4338dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo; 43394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4340dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 4341dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_ForwardRef = 0, 4342dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Interface = 1, 4343dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Implementation = 2 4344dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind; 43454e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43464e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 43476ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 4348dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainerKind kind; 4349dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo; 43504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43514e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 43526ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *base; 43536ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 43544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 43556ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo; 43564e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 43586ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *protocol; 43596ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 43604e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 43614e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo; 43624e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43634e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 43646ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxObjCProtocolRefInfo *const *protocols; 43654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned numProtocols; 4366c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo; 43674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 4369c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 4370c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxBaseClassInfo *superInfo; 4371c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 4372c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo; 43734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 43742957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct { 4375c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 4376c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 4377c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXCursor classCursor; 4378c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXIdxLoc classLoc; 4379c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 4380c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo; 4381c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis 4382c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct { 43832957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 4384792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *getter; 4385792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *setter; 4386792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis} CXIdxObjCPropertyDeclInfo; 4387792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 4388792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidistypedef struct { 4389792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 43902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxBaseClassInfo *const *bases; 43912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned numBases; 43922957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo; 43932957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 4394bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4395bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see indexEntityReference callback. 4396bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4397aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum { 4398bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4399bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity is referenced directly in user's code. 4400bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4401aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis CXIdxEntityRef_Direct = 1, 4402bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4403b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * \brief An implicit reference, e.g. a reference of an ObjC method via the 4404b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * dot syntax. 4405bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4406b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxEntityRef_Implicit = 2 4407aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind; 4408aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis 4409bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4410bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Data for \see indexEntityReference callback. 4411bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44124e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 4413b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis CXIdxEntityRefKind kind; 4414bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4415bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Reference cursor. 4416bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44174e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXCursor cursor; 44184e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 4419bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4420bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity that gets referenced. 4421bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44226ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *referencedEntity; 4423bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4424bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Immediate "parent" of the reference. For example: 4425bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4426bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \code 4427bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * Foo *var; 4428bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \endcode 4429bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4430bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * The parent of reference of type 'Foo' is the variable 'var'. 4431e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * For references inside statement bodies of functions/methods, 4432e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * the parentEntity will be the function/method. 4433bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44346ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *parentEntity; 4435bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4436e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * \brief Lexical container context of the reference. 4437bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *container; 44394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo; 44404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 44414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 4442bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 44436ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * \brief Called periodically to check whether indexing should be aborted. 44446ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * Should return 0 to continue, and non-zero to abort. 44456ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis */ 44466ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis int (*abortQuery)(CXClientData client_data, void *reserved); 44476ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 44486ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis /** 4449b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * \brief Called at the end of indexing; passes the complete diagnostic set. 4450bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44514e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*diagnostic)(CXClientData client_data, 4452b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXDiagnosticSet, void *reserved); 44534e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4454dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*enteredMainFile)(CXClientData client_data, 4455dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXFile mainFile, void *reserved); 4456dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 4457bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4458bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called when a file gets #included/#imported. 4459bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4460dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, 44616ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxIncludedFileInfo *); 44624e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4463bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4464bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called when a AST file (PCH or module) gets imported. 4465bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4466bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * AST files will not get indexed (there will not be callbacks to index all 4467bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the entities in an AST file). The recommended action is that, if the AST 4468bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * file is not already indexed, to block further indexing and initiate a new 44696ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * indexing job specific to the AST file. 4470bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4471dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, 44726ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxImportedASTFileInfo *); 44734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4474bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4475bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called at the beginning of indexing a translation unit. 4476bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4477dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, 44786ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void *reserved); 44794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 44806ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void (*indexDeclaration)(CXClientData client_data, 44812957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *); 44824e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4483bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4484bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called to index a reference of an entity. 4485bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 44864e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*indexEntityReference)(CXClientData client_data, 44876ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityRefInfo *); 44884e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 44894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks; 44904e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4491ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); 44926ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * 44936ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); 44946ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 44956ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * 44966ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); 4497dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 4498ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE 44996ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo * 45006ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); 45016ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 4502c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * 4503c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); 4504dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 4505792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * 4506792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidisclang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); 4507792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 4508b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * 4509b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); 4510b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 45112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo * 45122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); 45132957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45142957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45152957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a 45162957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 45172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer 45192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *); 45202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45212957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a 45232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 45242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45252957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 45262957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); 45272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity. 45302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45312957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity 45322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *); 45332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity. 45362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 45382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); 45392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45412957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief An indexing action, to be applied to one or multiple translation units 45422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * but not on concurrent threads. If there are threads doing indexing 45432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * concurrently, they should use different CXIndexAction objects. 45442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction; 45462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief An indexing action, to be applied to one or multiple translation units 45492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * but not on concurrent threads. If there are threads doing indexing 45502957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * concurrently, they should use different CXIndexAction objects. 45512957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 45522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated. 45532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); 45552957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 45562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 45572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action. 45582957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 45592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units 45602957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed. 45612957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 45622957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); 45632957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 456421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum { 456521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 456621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Used to indicate that no special indexing options are needed. 456721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 456821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXIndexOpt_None = 0x0, 456921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 457021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 457121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Used to indicate that \see indexEntityReference should be invoked 4572b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * for only one reference of an entity per source file that does not also 4573b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * include a declaration/definition of the entity. 457421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 457522490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis CXIndexOpt_SuppressRedundantRefs = 0x1, 457622490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis 457722490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis /** 457822490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * \brief Function-local symbols should be indexed. If this is not set 457922490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * function-local symbols will be ignored. 458022490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis */ 458158d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis CXIndexOpt_IndexFunctionLocalSymbols = 0x2, 458258d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis 458358d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis /** 458458d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * \brief Implicit function/class template instantiations should be indexed. 458558d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * If this is not set, implicit instantiations will be ignored. 458658d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis */ 4587b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, 4588b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis 4589b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis /** 4590b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis * \brief Suppress all compiler warnings when parsing for indexing. 4591b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis */ 4592b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis CXIndexOpt_SuppressWarnings = 0x8 459321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags; 459421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 4595bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4596bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding 4597bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * to that file via callbacks implemented through \see IndexerCallbacks. 4598bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4599bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will 4600bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks. 4601bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4602bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client 4603bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements. 4604bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4605bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks_size Size of \see IndexerCallbacks structure that gets 4606bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks. 4607bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 460821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is 460921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. 4610bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4611bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param out_TU [out] pointer to store a CXTranslationUnit that can be reused 4612bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * after indexing is finished. Set to NULL if you do not require it. 4613bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 461421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns 4615bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * non-zero, otherwise returns 0. 461621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 4617bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * The rest of the parameters are the same as \see clang_parseTranslationUnit. 4618bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 46192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, 46204e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXClientData client_data, 46214e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis IndexerCallbacks *index_callbacks, 46224e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_callbacks_size, 46234e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_options, 46244e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *source_filename, 46254e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char * const *command_line_args, 46264e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int num_command_line_args, 46274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis struct CXUnsavedFile *unsaved_files, 46284e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned num_unsaved_files, 46294e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXTranslationUnit *out_TU, 46304e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned TU_options); 46314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4632bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 463321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through 463421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \see IndexerCallbacks. 463521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 463621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as 463721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be: 463821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 463921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Preprocessor callbacks invocations 464021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Declaration/reference callbacks invocations 464121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Diagnostic callback invocations 464221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 464321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The parameters are the same as \see clang_indexSourceFile. 464421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 464521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns 464621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0. 464721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 46482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, 464921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXClientData client_data, 465021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis IndexerCallbacks *index_callbacks, 465121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis unsigned index_callbacks_size, 46522957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned index_options, 46532957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXTranslationUnit); 465421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 465521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/** 4656bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by 4657bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc. 4658bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 4659bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the 4660bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument 4661bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument. 4662bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 46634e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, 4664dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile *indexFile, 46654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile *file, 46664e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *line, 46674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *column, 46684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *offset); 46694e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4670bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4671bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc. 4672bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 46734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE 46744e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); 46754e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4676aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 4677aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @} 4678aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4679aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4680c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 4681c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 4682c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 46831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 4684d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus 4685d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek} 4686d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 4687d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 4688d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 4689