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 193d31560343856c573376a04558a7111e7afad4f7Chandler Carruth#include <time.h> 2088145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff 21db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/Platform.h" 22651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines#include "clang-c/CXErrorCode.h" 23db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/CXString.h" 24651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines#include "clang-c/BuildSystem.h" 25db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison 264d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis/** 274d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * \brief The version constants for the libclang API. 284d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MINOR should increase when there are API additions. 294d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. 304d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * 314d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * The policy about the libclang API was always to keep it source and ABI 324d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. 334d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis */ 34ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_MAJOR 0 356bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines#define CINDEX_VERSION_MINOR 27 36ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis 37ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_ENCODE(major, minor) ( \ 38ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis ((major) * 10000) \ 39ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis + ((minor) * 1)) 40ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis 41ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION CINDEX_VERSION_ENCODE( \ 42ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis CINDEX_VERSION_MAJOR, \ 43ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis CINDEX_VERSION_MINOR ) 44ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis 45ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRINGIZE_(major, minor) \ 46ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis #major"."#minor 47ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRINGIZE(major, minor) \ 48ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis CINDEX_VERSION_STRINGIZE_(major, minor) 49ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis 50ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE( \ 51ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis CINDEX_VERSION_MAJOR, \ 52ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis CINDEX_VERSION_MINOR) 53ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis 54d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus 55d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenekextern "C" { 56d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 57d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 5887fb9404cd962b78c98947d75d68be1691c4e737Douglas Gregor/** \defgroup CINDEX libclang: C Interface to Clang 5920d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * 601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The C Interface to Clang provides a relatively small API that exposes 61f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities for parsing source code into an abstract syntax tree (AST), 62f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * loading already-parsed ASTs, traversing the AST, associating 63f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * physical source locations with elements within the AST, and other 64f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * facilities that support Clang-based development tools. 65f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This C interface to Clang will never provide all of the information 67f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * representation stored in Clang's C++ AST, nor should it: the intent is to 68f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * maintain an API that is relatively stable from one release to the next, 69f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * providing only the basic functionality needed to support development tools. 701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * To avoid namespace pollution, data types are prefixed with "CX" and 72f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * functions are prefixed with "clang_". 7320d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * 7420d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @{ 7520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */ 761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 777f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/** 787f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief An "index" that consists of a set of translation units that would 797f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * typically be linked together into an executable or library. 807f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */ 817f17376e0931a337d544b75d9030bc92763be287Douglas Gregortypedef void *CXIndex; 82600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff 837f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/** 847f17376e0931a337d544b75d9030bc92763be287Douglas Gregor * \brief A single translation unit, which resides in an index. 857f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */ 860a90d32523bfe5fa63e11b648686c9699f786d15Ted Kremenektypedef struct CXTranslationUnitImpl *CXTranslationUnit; 87600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff 887f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/** 89c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Opaque pointer representing client data that will be passed through 90c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to various callbacks and visitors. 917f17376e0931a337d544b75d9030bc92763be287Douglas Gregor */ 92c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef void *CXClientData; 931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 94735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor/** 95735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * \brief Provides the contents of a file that has not yet been saved to disk. 96735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * 97735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * Each CXUnsavedFile instance provides the name of a file on the 98735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * system along with the current contents of that file that have not 99735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * yet been saved to disk. 100735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */ 101735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregorstruct CXUnsavedFile { 1021efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1031efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief The file whose contents have not yet been saved. 104735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * 105735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor * This file must already exist in the file system. 106735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */ 107735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor const char *Filename; 108735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor 1091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 110c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor * \brief A buffer containing the unsaved contents of this file. 111735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */ 112735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor const char *Contents; 113735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor 114735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor /** 115c8dfe5ece04e683106eb96c58a2999f70b53ac21Douglas Gregor * \brief The length of the unsaved contents of this buffer. 116735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor */ 117735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor unsigned long Length; 118735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor}; 119735df88a38e80c1ca70daa889aa516b8b9f54b50Douglas Gregor 120076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne/** 121076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief Describes the availability of a particular entity, which indicates 122076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * whether the use of this entity will result in a warning or error due to 123076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * it being deprecated or unavailable. 124076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */ 12558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorenum CXAvailabilityKind { 126076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne /** 127076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief The entity is available. 128076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */ 12958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor CXAvailability_Available, 130076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne /** 131076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief The entity is available, but has been deprecated (and its use is 132076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * not recommended). 133076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */ 13458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor CXAvailability_Deprecated, 135076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne /** 136076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne * \brief The entity is not available; any use of it will be an error. 137076c22a99ed82e11b59e8fbf57d8467ceb3fec77Peter Collingbourne */ 138d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen CXAvailability_NotAvailable, 139d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen /** 140d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen * \brief The entity is available, but not accessible; any use of it will be 141d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen * an error. 142d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen */ 143d12059673dcef32bc2b6bae5321654d33863afe6Erik Verbruggen CXAvailability_NotAccessible 14458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor}; 145cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 146cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 147cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Describes a version number of the form major.minor.subminor. 148cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 149cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXVersion { 150cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 151cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The major version number, e.g., the '10' in '10.7.3'. A negative 152cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * value indicates that there is no version number at all. 153cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 154cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int Major; 155cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 156cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The minor version number, e.g., the '7' in '10.7.3'. This value 157cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * will be negative if no minor version number was provided, e.g., for 158cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * version '10'. 159cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 160cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int Minor; 161cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 162cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The subminor version number, e.g., the '3' in '10.7.3'. This value 163cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * will be negative if no minor or subminor version number was provided, 164cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * e.g., in version '10' or '10.7'. 165cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 166cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int Subminor; 167cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXVersion; 16858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 1697f17376e0931a337d544b75d9030bc92763be287Douglas Gregor/** 1707eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Provides a shared context for creating translation units. 1717eee0184570366285589d788bcd7f5dda8345915James Dennett * 1727eee0184570366285589d788bcd7f5dda8345915James Dennett * It provides two options: 173e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * 174e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" 175e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * declarations (when loading any new translation units). A "local" declaration 1761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * is one that belongs in the translation unit itself and not in a precompiled 177e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * header that was used by the translation unit. If zero, all declarations 178e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * will be enumerated. 179e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * 180b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * Here is an example: 181b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * 1827eee0184570366285589d788bcd7f5dda8345915James Dennett * \code 1830a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * // excludeDeclsFromPCH = 1, displayDiagnostics=1 1840a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * Idx = clang_createIndex(1, 1); 185b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * 186b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * // IndexTest.pch was produced with the following command: 187b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" 188b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); 189b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * 190b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * // This will load all the symbols from 'IndexTest.pch' 1911efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * clang_visitChildren(clang_getTranslationUnitCursor(TU), 192002a528ab0189fc60cfbf9328962c96ccbe567eeDouglas Gregor * TranslationUnitVisitor, 0); 193b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * clang_disposeTranslationUnit(TU); 194b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * 195b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * // This will load all the symbols from 'IndexTest.c', excluding symbols 196b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * // from 'IndexTest.pch'. 197fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" }; 198fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args, 199fd9f23464bfd35314c87c4df410f3937d59eb96dDaniel Dunbar * 0, 0); 200b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor * clang_visitChildren(clang_getTranslationUnitCursor(TU), 201b2cd48756119f4d8d2a865b4b3e0e8efd02e26a0Douglas Gregor * TranslationUnitVisitor, 0); 202b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * clang_disposeTranslationUnit(TU); 2037eee0184570366285589d788bcd7f5dda8345915James Dennett * \endcode 204b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * 205b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * This process of creating the 'pch', loading it separately, and using it (via 206b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks 207b4ece6377d95e35a8df01cd010d910c34d690f67Steve Naroff * (which gives the indexer the same performance benefit as the compiler). 208e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */ 2090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, 2100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor int displayDiagnostics); 211896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 2120087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor/** 2130087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * \brief Destroy the given index. 2140087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * 2150087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * The index must not be destroyed until all of the translation units created 2160087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor * within that index have been destroyed. 2170087e1a12b67b6bb032a72ea485a863daeccf55bDouglas Gregor */ 2188506dde586459887b7e14e23a30af8ac5be5adb6Daniel DunbarCINDEX_LINKAGE void clang_disposeIndex(CXIndex index); 2191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 220fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidistypedef enum { 221fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 222fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that no special CXIndex options are needed. 223fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 224fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_None = 0x0, 225fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 226fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 227fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that threads that libclang creates for indexing 228fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * purposes should use background priority. 2297eee0184570366285589d788bcd7f5dda8345915James Dennett * 2307eee0184570366285589d788bcd7f5dda8345915James Dennett * Affects #clang_indexSourceFile, #clang_indexTranslationUnit, 2317eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_parseTranslationUnit, #clang_saveTranslationUnit. 232fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 233fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForIndexing = 0x1, 234fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 235fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 236fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that threads that libclang creates for editing 237fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * purposes should use background priority. 2387eee0184570366285589d788bcd7f5dda8345915James Dennett * 2397eee0184570366285589d788bcd7f5dda8345915James Dennett * Affects #clang_reparseTranslationUnit, #clang_codeCompleteAt, 2407eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_annotateTokens 241fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 242fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForEditing = 0x2, 243fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 244fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis /** 245fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Used to indicate that all threads that libclang creates should use 246fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * background priority. 247fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 248fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForAll = 249fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForIndexing | 250fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis CXGlobalOpt_ThreadBackgroundPriorityForEditing 251fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 252fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis} CXGlobalOptFlags; 253fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 254fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/** 2557eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Sets general options associated with a CXIndex. 256fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 257fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * For example: 258fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \code 259fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * CXIndex idx = ...; 260fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * clang_CXIndex_setGlobalOptions(idx, 261fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * clang_CXIndex_getGlobalOptions(idx) | 262fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * CXGlobalOpt_ThreadBackgroundPriorityForIndexing); 263fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \endcode 264fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 265fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \param options A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags. 266fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 267fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE void clang_CXIndex_setGlobalOptions(CXIndex, unsigned options); 268fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 269fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis/** 270fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \brief Gets the general options associated with a CXIndex. 271fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * 272fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * \returns A bitmask of options, a bitwise OR of CXGlobalOpt_XXX flags that 273fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis * are associated with the given CXIndex object. 274fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis */ 275fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_CXIndex_getGlobalOptions(CXIndex); 276fdc1795acc9d5d73a767cc7d43ad1546e93adbbaArgyrios Kyrtzidis 2771efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 278c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_FILES File manipulation routines 279f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 280f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{ 281f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 2821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 283f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 284f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief A particular source file that is part of a translation unit. 285f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 286f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregortypedef void *CXFile; 2871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 288f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor 289f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 290f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the complete file and path name of the given file. 29188145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff */ 29274844072411bae91d5dbb89955d200cbe1e0a1c8Ted KremenekCINDEX_LINKAGE CXString clang_getFileName(CXFile SFile); 2931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 294f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 295f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \brief Retrieve the last modification time of the given file. 296f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 29708b0e8daeb683686b876d72674962ad96df21d45Douglas GregorCINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile); 29888145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff 2993c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/** 300db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \brief Uniquely identifies a CXFile, that refers to the same underlying file, 301db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * across an indexing session. 302db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis */ 303db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidistypedef struct { 304db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis unsigned long long data[3]; 305db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis} CXFileUniqueID; 306db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis 307db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis/** 308db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \brief Retrieve the unique ID for the given \c file. 309db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * 310db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \param file the file to get the ID for. 311db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \param outID stores the returned CXFileUniqueID. 312db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * \returns If there was a failure getting the unique ID, returns non-zero, 313db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis * otherwise returns 0. 314db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis*/ 315db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios KyrtzidisCINDEX_LINKAGE int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID); 316db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis 317db84e7a44dce24c3a8e4e0fc84434c00fc2da168Argyrios Kyrtzidis/** 318dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against 319dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional 3207eee0184570366285589d788bcd7f5dda8345915James Dennett * \#ifndef/\#define/\#endif macro guards or with \#pragma once. 321dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */ 322dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned 323dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); 324dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor 325dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/** 326b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit. 327b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 328b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit 3291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 330b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file. 331b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 332b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu, 333b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit. 334b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 3351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, 336b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor const char *file_name); 3371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 338b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 339f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 340f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 341f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor 342f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 343f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations 344f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 345f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in 346f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of 347f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are 348f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular 349f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract 350f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types. 351f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 352f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{ 353f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 3541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 355f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 3561db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation 3571db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit. 3581db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 35920174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation() 360a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column. 3613c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3623c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 363e2748288a04cda2e976a3fe859e4334afaf9274aArgyrios Kyrtzidis const void *ptr_data[2]; 3641db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned int_data; 3653c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation; 366fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3673c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/** 368d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code. 3693c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor * 3701db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the 3711db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively. 3723c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3733c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 374e2748288a04cda2e976a3fe859e4334afaf9274aArgyrios Kyrtzidis const void *ptr_data[2]; 3751db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned begin_int_data; 3761db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned end_int_data; 3773c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange; 378fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3791db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 380b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location. 381b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 382f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); 3831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 384b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3857eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two source locations, which must refer into 3861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source 387b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code. 388b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 389b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero 390b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations. 391b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 392b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, 393b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation loc2); 3941efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 395b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column 3971efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit. 398b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 399b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, 400b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXFile file, 401b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned line, 402b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned column); 40383889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/** 40483889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset 40583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit. 40683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */ 40783889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, 40883889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall CXFile file, 40983889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall unsigned offset); 4101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 411b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 4124522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis * \brief Returns non-zero if the given source location is in a system header. 4134522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis */ 4144522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios KyrtzidisCINDEX_LINKAGE int clang_Location_isInSystemHeader(CXSourceLocation location); 4154522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis 4164522f63e00fa6f1276b1d29763a9a4f46f46b6a1Argyrios Kyrtzidis/** 417ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du Toit * \brief Returns non-zero if the given source location is in the main file of 418ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du Toit * the corresponding translation unit. 419ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du Toit */ 420ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du ToitCINDEX_LINKAGE int clang_Location_isFromMainFile(CXSourceLocation location); 421ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du Toit 422ad0d5707463cd7875e1ffd50dacd3f900d185aa1Stefanus Du Toit/** 4235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range. 4245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 425f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceRange clang_getNullRange(void); 426896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 428b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source 429b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations. 430b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 431b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, 432b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation end); 4331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 434b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 435ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent. 436ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * 437ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ. 438ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */ 439ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, 440ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor CXSourceRange range2); 441ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor 442ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/** 4431824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p range is null. 444de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */ 445733dbc805facad7cebec5420f6c47c83848cee5fErik VerbruggenCINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); 446de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis 447de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/** 44846766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by 44946766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location. 4501db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 45120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the 45220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion. 453a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 4541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed 4551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts. 4561db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given 4581db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4591db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4601efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given 4611db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4621db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given 4641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points. 46546766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * 46646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 46746766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points. 4681db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 46920174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, 47020174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth CXFile *file, 47120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *line, 47220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *column, 47320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *offset); 47420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth 47520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/** 476e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by 477e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive. 478e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 479e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c 480e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 4817eee0184570366285589d788bcd7f5dda8345915James Dennett * \code 482e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1 483e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 484e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void) 485e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * { 486e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * return 0; 487e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * } 4887eee0184570366285589d788bcd7f5dda8345915James Dennett * \endcode 489e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 490e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be 491e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 492e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12 493e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 494e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned 495e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 496e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12 497e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 498e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed 499e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts. 500e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 501e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the 502e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files, 503e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when 504e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If 505e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value 506e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid 507e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned. 508e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 509e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the 510e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 511e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 512e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the 513e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 514e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */ 515e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, 516e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis CXString *filename, 517e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *line, 518e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *column); 519e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis 520e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/** 52120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented 52220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location. 52320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * 52420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface 5257eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_getExpansionLocation(). See that interface's documentation for 52620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details. 52720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */ 5281db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, 5291db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor CXFile *file, 5301db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned *line, 53146766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *column, 53246766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *offset); 533e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor 534e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/** 535a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by 536a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location. 537a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 538a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the 539a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file. 540a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 541a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed 542a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts. 543a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 544a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given 545a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 546a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 547a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given 548a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 549a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 550a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given 551a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 552a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 553a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 554a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points. 555a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */ 556a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, 557a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor CXFile *file, 558a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *line, 559a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *column, 560a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *offset); 5612d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis 5622d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis/** 5632d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by 5642d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * the given source location. 5652d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5662d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * If the location refers into a macro expansion, return where the macro was 5672d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * expanded or where the macro argument was written, if the location points at 5682d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * a macro argument. 5692d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5702d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed 5712d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * into its parts. 5722d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5732d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param file [out] if non-NULL, will be set to the file to which the given 5742d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5752d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5762d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line to which the given 5772d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5782d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5792d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column to which the given 5802d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5812d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5822d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param offset [out] if non-NULL, will be set to the offset into the 5832d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * buffer to which the given source location points. 5842d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis */ 5852d5c133d3dd95507db63147997109f06e8cfa833Argyrios KyrtzidisCINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, 5862d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis CXFile *file, 5872d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *line, 5882d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *column, 5892d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *offset); 590a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor 591a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/** 5921efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a 5931efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 5941db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 5951db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); 5961db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 5971db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 5981efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a 5991efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 6001db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 6011db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); 6021db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 603f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 604651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Identifies an array of ranges. 605651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 606651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinestypedef struct { 607651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /** \brief The number of ranges in the \c ranges array. */ 608651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines unsigned count; 609651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /** 610651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief An array of \c CXSourceRanges. 611651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 612651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXSourceRange *ranges; 613651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines} CXSourceRangeList; 614651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 615651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 616651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Retrieve all ranges that were skipped by the preprocessor. 617651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 618651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * The preprocessor will skip lines when they are surrounded by an 619651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * if/ifdef/ifndef directive whose condition does not evaluate to true. 620651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 621651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE CXSourceRangeList *clang_getSkippedRanges(CXTranslationUnit tu, 622651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXFile file); 623651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 624651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 625651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Destroy the given \c CXSourceRangeList. 626651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 627651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE void clang_disposeSourceRangeList(CXSourceRangeList *ranges); 628651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 629651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 630f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 631f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 632c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 633c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 6345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting 6355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 6365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 6375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 6405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic. 6415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity { 6435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 644896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief A diagnostic that has been suppressed, e.g., by a command-line 6455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * option. 6465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Ignored = 0, 648896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 6495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic is a note that should be attached to the 6515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * previous (non-note) diagnostic. 6525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6535352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Note = 1, 6545352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6555352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates suspicious code that may not be 6575352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * wrong. 6585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Warning = 2, 6605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed. 6635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Error = 3, 6655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed such 6685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * that future parser recovery is unlikely to produce useful 6695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * results. 6705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Fatal = 4 6725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor}; 6735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 6755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity, 6765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints. 6775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic; 6795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 681153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief A group of CXDiagnostics. 682153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 683153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenektypedef void *CXDiagnosticSet; 684153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 685153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 686153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Determine the number of diagnostics in a CXDiagnosticSet. 687153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 688153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); 689153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 690153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 691153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet. 692153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 6937eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Diags the CXDiagnosticSet to query. 694153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Index the zero-based diagnostic number to retrieve. 695153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 696153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns the requested diagnostic. This diagnostic must be freed 697153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * via a call to \c clang_disposeDiagnostic(). 698153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 699153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, 700153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek unsigned Index); 701153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 702153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 703153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 704153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Describes the kind of error that occurred (if any) in a call to 705153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \c clang_loadDiagnostics. 706153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 707153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenekenum CXLoadDiag_Error { 708153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 709153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that no error occurred. 710153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 711153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_None = 0, 712153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 713153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 714153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that an unknown error occurred while attempting to 715153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserialize diagnostics. 716153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 717153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_Unknown = 1, 718153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 719153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 720153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the file containing the serialized diagnostics 721153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * could not be opened. 722153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 723153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_CannotLoad = 2, 724153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 725153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 726153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the serialized diagnostics file is invalid or 7277eee0184570366285589d788bcd7f5dda8345915James Dennett * corrupt. 728153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 729153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_InvalidFile = 3 730153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek}; 731153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 732153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 733153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode 7347eee0184570366285589d788bcd7f5dda8345915James Dennett * file. 735153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 7367eee0184570366285589d788bcd7f5dda8345915James Dennett * \param file The name of the file to deserialize. 7377eee0184570366285589d788bcd7f5dda8345915James Dennett * \param error A pointer to a enum value recording if there was a problem 738153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserializing the diagnostics. 7397eee0184570366285589d788bcd7f5dda8345915James Dennett * \param errorString A pointer to a CXString for recording the error string 740153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * if the file was not successfully loaded. 741153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 742153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These 7437eee0184570366285589d788bcd7f5dda8345915James Dennett * diagnostics should be released using clang_disposeDiagnosticSet(). 744153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 745153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, 746153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek enum CXLoadDiag_Error *error, 747153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXString *errorString); 748153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 749153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 750153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Release a CXDiagnosticSet and all of its contained diagnostics. 751153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 752153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); 753153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 754153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 7557eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the child diagnostics of a CXDiagnostic. 7567eee0184570366285589d788bcd7f5dda8345915James Dennett * 7577eee0184570366285589d788bcd7f5dda8345915James Dennett * This CXDiagnosticSet does not need to be released by 7588c927fca2a31d1dda461cdf3be6aab3fa25c70b4Sylvestre Ledru * clang_disposeDiagnosticSet. 759153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 760153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); 761153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 762153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 763a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given 764a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit. 765a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 766a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); 767a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 768a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 769a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit. 7705352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 771a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query. 772a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 7735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 774a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 775a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 7765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 777a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, 778a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 779a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 780a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 7810373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \brief Retrieve the complete set of diagnostics associated with a 7820373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * translation unit. 7830373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * 7840373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \param Unit the translation unit to query. 7850373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek */ 7860373fcc3e5b205cc26656c70d7dff737b0e08345Ted KremenekCINDEX_LINKAGE CXDiagnosticSet 7870373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); 7880373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek 7890373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek/** 790a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic. 791a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 792a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); 7935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 7945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 7950a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics. 7960a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7970a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the 7988c927fca2a31d1dda461cdf3be6aab3fa25c70b4Sylvestre Ledru * behavior of \c clang_formatDiagnostic(). 7990a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 8000a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions { 8010a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 8020a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Display the source-location information where the 8030a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic was located. 8040a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8050a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * When set, diagnostics will be prefixed by the file, line, and 8060a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * (optionally) column to which the diagnostic refers. For example, 8070a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8080a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \code 8090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * test.c:28: warning: extra tokens at end of #endif directive 8100a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \endcode 8110a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8120a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-source-location. 8130a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 8140a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplaySourceLocation = 0x01, 8150a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8160a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 8170a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 8180a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include the column number. 8190a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8200a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-column. 8210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 8220a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplayColumn = 0x02, 8230a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8240a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 8250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 8260a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include information about source ranges in a 8270a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * machine-parsable format. 8280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 829896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * This option corresponds to the clang flag 8300a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \c -fdiagnostics-print-source-range-info. 8310a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 832aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplaySourceRanges = 0x04, 833aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 834aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 835aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the option name associated with this diagnostic, if any. 836aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 837aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The option name displayed (e.g., -Wconversion) will be placed in brackets 838aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * after the diagnostic text. This option corresponds to the clang flag 839aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-option. 840aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 841aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayOption = 0x08, 842aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 843aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 844aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category number associated with this diagnostic, if any. 845aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 846aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category number is displayed within brackets after the diagnostic text. 847aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 848aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=id. 849aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 850aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryId = 0x10, 851aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 852aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 853aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category name associated with this diagnostic, if any. 854aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 855aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category name is displayed within brackets after the diagnostic text. 856aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 857aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=name. 858aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 859aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryName = 0x20 8600a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor}; 8610a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8620a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 863274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display. 8640a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 865274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering 866896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The 867896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of 8680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler. 8690a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print. 8710a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 872896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display, 8730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values. 874274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * 875274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic. 8760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 877274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, 878274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor unsigned Options); 8790a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8800a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 8810a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the 8820a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler. 8830a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8840a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c 8858c927fca2a31d1dda461cdf3be6aab3fa25c70b4Sylvestre Ledru * clang_formatDiagnostic(). 8860a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 8870a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); 8880a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8890a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 8905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic. 8915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 892896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity 8935352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic); 8945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 8965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic. 8975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 8985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when 8995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line. 9005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); 9025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic. 9055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); 907a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor 908a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/** 909aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this 910aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic. 911aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 912aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried. 913aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 914aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this 915aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any). 916aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 917aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this 918aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic". 919aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 920aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, 921aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXString *Disable); 922aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 923aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 924aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic. 925aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 926aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related 927aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine 928aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic. 929aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 930aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero 931aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized. 932aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 933aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); 934aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 935aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 93678d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the name of a particular diagnostic category. This 93778d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * is now deprecated. Use clang_getDiagnosticCategoryText() 93878d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * instead. 939aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 940aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by 941aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory(). 942aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 943aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category. 944aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 94578d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_DEPRECATED CINDEX_LINKAGE 94678d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCXString clang_getDiagnosticCategoryName(unsigned Category); 94778d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek 94878d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek/** 94978d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the diagnostic category text for a given diagnostic. 95078d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * 95178d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \returns The text of the given diagnostic category. 95278d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek */ 95378d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); 954aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 955aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 956a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given 957a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic. 958a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */ 959a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); 960896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 9615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 962a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic. 9635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 964a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source 9655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by 966896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters. 9675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 968a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted. 9695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 970896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to 9715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 972a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range. 9735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 974896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, 975a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor unsigned Range); 9765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the 9795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic. 9805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); 9825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 984473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it. 9855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 986473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents 987473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over 988473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers 989473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty), 990473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be 991473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and 992473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the 993473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to 994473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert). 9955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 996473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried. 9975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 998473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it. 9995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 1000473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be 1001473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source 1002473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be 1003473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b. 10045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 1005473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source 1006473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange. 10075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1008896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, 1009473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor unsigned FixIt, 1010473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor CXSourceRange *ReplacementRange); 10115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 10125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 10135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 10145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 10155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 10165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 10175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation 10185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy 10205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or 10215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit. 10225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 10245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1025896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 10265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 10275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name. 10285352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 10295352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString 10305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); 10315352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 10325352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 10335352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided 10345352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler. 10355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional. If the caller provides a 10375352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the 10385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments. 10395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options 10415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored: 10425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-c' 10445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-emit-ast' 10455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-fsyntax-only' 10467eee0184570366285589d788bcd7f5dda8345915James Dennett * '-o \<output file>' (both '-o' and '\<output file>' are ignored) 10475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10481ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be 10491ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated. 10505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10517eee0184570366285589d788bcd7f5dda8345915James Dennett * \param source_filename The name of the source file to load, or NULL if the 10521ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args. 10531ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 10541ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in 10551ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args. 10561ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 10571ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be 10581ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process. 10591ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation 10601ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c', 10617eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 10625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 10645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files. 10655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 10675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of 1068c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files. The contents and name of these files (as specified by 1069c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to 1070c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns. 10715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 10725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( 10735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXIndex CIdx, 10745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor const char *source_filename, 10755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor int num_clang_command_line_args, 10762ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor const char * const *clang_command_line_args, 10775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor unsigned num_unsaved_files, 1078a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor struct CXUnsavedFile *unsaved_files); 1079896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 10805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1081651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Same as \c clang_createTranslationUnit2, but returns 1082651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * the \c CXTranslationUnit instead of an error code. In case of an error this 1083651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * routine returns a \c NULL \c CXTranslationUnit, without further detailed 1084651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * error codes. 1085651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 1086651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( 1087651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXIndex CIdx, 1088651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *ast_filename); 1089651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 1090651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 1091651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Create a translation unit from an AST file (\c -emit-ast). 1092651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 1093651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \param[out] out_TU A non-NULL pointer to store the created 1094651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \c CXTranslationUnit. 1095651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 1096651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \returns Zero on success, otherwise returns an error code. 10975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1098651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE enum CXErrorCode clang_createTranslationUnit2( 1099651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXIndex CIdx, 1100651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *ast_filename, 1101651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXTranslationUnit *out_TU); 11025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 110344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/** 110444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units. 110544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 110644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise 110744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when 110844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit. 110944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 11105a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags { 11115a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 11125a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that no special translation-unit options are 11135a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * needed. 11145a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 11155a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor CXTranslationUnit_None = 0x0, 11165a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 11175a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 11185a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that the parser should construct a "detailed" 11195a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * preprocessing record, including all macro definitions and instantiations. 11205a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11215a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * Constructing a detailed preprocessing record requires more memory 11225a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * and time to parse, since the information contained in the record 11235a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is usually not retained. However, it can be useful for 11245a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * applications that require more detailed information about the 11255a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * behavior of the preprocessor. 11265a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 112744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor CXTranslationUnit_DetailedPreprocessingRecord = 0x01, 112844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 112944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 1130b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Used to indicate that the translation unit is incomplete. 113144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 1132b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * When a translation unit is considered "incomplete", semantic 1133b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * analysis that is typically performed at the end of the 1134b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * translation unit will be suppressed. For example, this suppresses 1135b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * the completion of tentative declarations in C and of 1136b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * instantiation of implicitly-instantiation function templates in 1137b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * C++. This option is typically used when parsing a header with the 1138b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * intent of producing a precompiled header. 113944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1140b1c031be513705d924038f497279b9b599868ba1Douglas Gregor CXTranslationUnit_Incomplete = 0x02, 114144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 114244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 114344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Used to indicate that the translation unit should be built with an 114444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header for the preamble. 114544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 114644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * An implicit precompiled header is used as an optimization when a 114744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * particular translation unit is likely to be reparsed many times 114844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * when the sources aren't changing that often. In this case, an 114944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header will be built containing all of the 115044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * initial includes at the top of the main file (what we refer to as 115144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * the "preamble" of the file). In subsequent parses, if the 115244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * preamble or the files in it have not changed, \c 115344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * clang_reparseTranslationUnit() will re-use the implicit 115444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * precompiled header to improve parsing performance. 115544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1156e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXTranslationUnit_PrecompiledPreamble = 0x04, 1157e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1158e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1159e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that the translation unit should cache some 1160e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion results with each reparse of the source file. 1161e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1162e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * Caching of code-completion results is a performance optimization that 1163e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * introduces some overhead to reparsing but improves the performance of 1164e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion operations. 1165e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 116699ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor CXTranslationUnit_CacheCompletionResults = 0x08, 1167900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis 116899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1169900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * \brief Used to indicate that the translation unit will be serialized with 1170900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * \c clang_saveTranslationUnit. 117199ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 1172900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * This option is typically used when parsing a header with the intent of 1173900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * producing a precompiled header. 117499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 1175900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis CXTranslationUnit_ForSerialization = 0x10, 117699ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor 117799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1178b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * \brief DEPRECATED: Enabled chained precompiled preambles in C++. 117999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 118099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * Note: this is a *temporary* option that is available only while 1181b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * we are testing C++ precompiled preamble support. It is deprecated. 118299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 11836a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen CXTranslationUnit_CXXChainedPCH = 0x20, 11846a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen 11856a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen /** 11866a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * \brief Used to indicate that function/method bodies should be skipped while 11876a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * parsing. 11886a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * 11896a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * This option can be used to search for declarations/definitions while 11906a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * ignoring the usages. 11916a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen */ 1192d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXTranslationUnit_SkipFunctionBodies = 0x40, 1193d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 1194d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko /** 1195d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Used to indicate that brief documentation comments should be 1196d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * included into the set of code completions returned from this translation 1197d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * unit. 1198d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 1199d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80 12005a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor}; 12015a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 12025a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/** 1203b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation 1204b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited. 1205b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * 1206b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit() 1207b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times, 1208b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly 1209b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag 1210b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled 1211b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The 1212b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next. 1213b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */ 1214e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); 1215651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 1216651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 1217651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Same as \c clang_parseTranslationUnit2, but returns 1218651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * the \c CXTranslationUnit instead of an error code. In case of an error this 1219651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * routine returns a \c NULL \c CXTranslationUnit, without further detailed 1220651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * error codes. 1221651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 1222651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE CXTranslationUnit 1223651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesclang_parseTranslationUnit(CXIndex CIdx, 1224651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *source_filename, 1225651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *const *command_line_args, 1226651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines int num_command_line_args, 1227651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines struct CXUnsavedFile *unsaved_files, 1228651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines unsigned num_unsaved_files, 1229651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines unsigned options); 1230651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 1231b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/** 12325a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding 12335a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file. 12345a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12355a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the 12365a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be 12375a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of 12385a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same 12395a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line. 12405a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be 12425a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated. 12435a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12445a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the 1245651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * source file is included in \c command_line_args. 12465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be 12485a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process. 12495a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation 12505a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c', 12517eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 12525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in 1254651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \c command_line_args. 12555a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12565a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 12571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of 12585a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files. The contents and name of these files (as specified by 12595a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 12605a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns. 12615a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12625a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 12635a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files. 12645a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 12655a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit 12665a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the 12675a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags. 12685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 1269651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \param[out] out_TU A non-NULL pointer to store the created 1270651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \c CXTranslationUnit, describing the parsed code and containing any 1271651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * diagnostics produced by the compiler. 1272651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 1273651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \returns Zero on success, otherwise returns an error code. 12745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 1275651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE enum CXErrorCode 1276651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesclang_parseTranslationUnit2(CXIndex CIdx, 1277651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *source_filename, 1278651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines const char *const *command_line_args, 1279651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines int num_command_line_args, 1280651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines struct CXUnsavedFile *unsaved_files, 1281651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines unsigned num_unsaved_files, 1282651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines unsigned options, 1283651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXTranslationUnit *out_TU); 1284651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 12855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 12861999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved. 12871999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 12881999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 12891999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when 12901999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit. 12911999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 12921999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags { 12931999844e7a18786e61e619e1dc6c789827541863Douglas Gregor /** 12941999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Used to indicate that no special saving options are needed. 12951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 12961999844e7a18786e61e619e1dc6c789827541863Douglas Gregor CXSaveTranslationUnit_None = 0x0 12971999844e7a18786e61e619e1dc6c789827541863Douglas Gregor}; 12981999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 12991999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 13001999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation 13011999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit. 13021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 13031999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for 13041999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag 13051999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with 13061999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data. 13071999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 13081999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); 13091999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 13101999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 131139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to 131239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit(). 131339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 131439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError { 131539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 131639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that no error occurred while saving a translation unit. 131739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 131839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_None = 0, 131939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 132039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 132139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that an unknown error occurred while attempting to save 132239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * the file. 132339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 132439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * This error typically indicates that file I/O failed when attempting to 132539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * write the file. 132639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 132739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_Unknown = 1, 132839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 132939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 133039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that errors during translation prevented this attempt 133139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * to save the translation unit. 133239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 133339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * Errors that prevent the translation unit from being saved can be 133439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). 133539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 133639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_TranslationErrors = 2, 133739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 133839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 133939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that the translation unit to be saved was somehow 134039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * invalid (e.g., NULL). 134139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 134239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_InvalidTU = 3 134339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor}; 134439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 134539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/** 13467ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of 13477ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk. 13487ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 13497ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved 13507ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a 13517ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, 13527ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a 13537ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation 13547ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units. 13557ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 13567ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save. 13571999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 13587ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved. 13597ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 13601999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit 13611999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the 13621999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags. 13631999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 136439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError 136539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 136639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred. 13677ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */ 13687ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, 13691999844e7a18786e61e619e1dc6c789827541863Douglas Gregor const char *FileName, 13701999844e7a18786e61e619e1dc6c789827541863Douglas Gregor unsigned options); 13717ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor 13727ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/** 13735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object. 13745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 13755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); 1376896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 13775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1378e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units. 1379e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1380e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 1381e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when 1382e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit. 1383e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1384e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags { 1385e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1386e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that no special reparsing options are needed. 1387e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1388e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXReparse_None = 0x0 1389e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor}; 1390e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1391e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1392e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation 1393e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit. 1394e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1395e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for 1396e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag 1397e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses 1398e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version 1399e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next. 1400e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1401e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); 1402e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1403e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1404abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit. 1405abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1406abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally 1407abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files 1408abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The 1409abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it 1410abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed. 1411abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1412abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations 1413abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation 1414abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then 1415abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments. 1416abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation 1417abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine. 1418abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1419abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The 1420abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with 1421abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile(). 1422abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1423abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 1424abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files. 1425abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1426abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk 1427abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of 1428abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files. The contents and name of these files (as specified by 1429abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 1430abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns. 1431abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1432e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags. 1433e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of 1434e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit. 1435e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1436651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \returns 0 if the sources could be reparsed. A non-zero error code will be 1437abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is 1438651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * invalid. In such cases, the only valid call for \c TU is 1439651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \c clang_disposeTranslationUnit(TU). The error codes returned by this 1440651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * routine are described by the \c CXErrorCode enum. 1441abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */ 1442abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, 1443abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor unsigned num_unsaved_files, 1444e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor struct CXUnsavedFile *unsaved_files, 1445e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor unsigned options); 144659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 144759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 144859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Categorizes how memory is being used by a translation unit. 144959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1450f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind { 1451f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_AST = 1, 1452f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Identifiers = 2, 1453f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Selectors = 3, 1454f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_GlobalCompletionResults = 4, 1455457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek CXTUResourceUsage_SourceManagerContentCache = 5, 1456ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek CXTUResourceUsage_AST_SideTables = 6, 1457f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, 1458e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, 1459e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 1460e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 14615e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_Preprocessor = 11, 14625e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_PreprocessingRecord = 12, 1463ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek CXTUResourceUsage_SourceManager_DataStructures = 13, 1464d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch = 14, 1465f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, 1466f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_END = 1467d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch, 1468f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek 1469f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_First = CXTUResourceUsage_AST, 1470d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch 147159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek}; 147259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 147359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 147459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Returns the human-readable null-terminated C string that represents 1475f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * the name of the memory category. This string should never be freed. 147659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 147759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE 1478f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); 147959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1480f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry { 148159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The memory usage category. */ 1482f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek enum CXTUResourceUsageKind kind; 1483f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek /* \brief Amount of resources used. 1484f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek The units will depend on the resource kind. */ 148559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned long amount; 1486f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry; 148759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 148859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 148959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief The memory usage of a CXTranslationUnit, broken into categories. 149059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1491f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage { 149259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief Private data member, used for queries. */ 149359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek void *data; 149459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 149559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The number of entries in the 'entries' array. */ 149659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned numEntries; 149759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 149859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief An array of key-value pairs, representing the breakdown of memory 149959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek usage. */ 1500f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsageEntry *entries; 150159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1502f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage; 150359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 150459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 150559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Return the memory usage of a translation unit. This object 1506f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * should be released with clang_disposeCXTUResourceUsage(). 150759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1508f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); 150959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1510f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); 151159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1512abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/** 15135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 15145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1515896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 15165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1517c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to. 1518c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1519c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind { 1520c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Declarations */ 15211efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1522c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A declaration whose specific kind is not exposed via this 15231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1524c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1525c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed declarations have the same operations as any other kind 1526c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of declaration; one can extract their location information, 1527c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, find their definitions, etc. However, the specific kind 1528c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of the declaration is not reported. 1529c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1530c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedDecl = 1, 1531c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ struct. */ 15321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_StructDecl = 2, 1533c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ union. */ 1534c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnionDecl = 3, 1535c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C++ class. */ 1536c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ClassDecl = 4, 1537c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumeration. */ 1538c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumDecl = 5, 15391efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1540c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A field (in C) or non-static data member (in C++) in a 1541c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * struct, union, or C++ class. 1542c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1543c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FieldDecl = 6, 1544c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumerator constant. */ 1545c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumConstantDecl = 7, 1546c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function. */ 1547c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FunctionDecl = 8, 1548c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A variable. */ 1549c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_VarDecl = 9, 1550c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function or method parameter. */ 1551c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ParmDecl = 10, 155217d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@interface. */ 1553c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInterfaceDecl = 11, 155417d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@interface for a category. */ 1555c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryDecl = 12, 155617d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@protocol declaration. */ 1557c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolDecl = 13, 155817d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@property declaration. */ 1559c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCPropertyDecl = 14, 1560c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance variable. */ 1561c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCIvarDecl = 15, 1562c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance method. */ 1563c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInstanceMethodDecl = 16, 1564c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C class method. */ 1565c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassMethodDecl = 17, 156617d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@implementation. */ 1567c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCImplementationDecl = 18, 156817d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@implementation for a category. */ 1569c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryImplDecl = 19, 1570c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A typedef */ 1571c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypedefDecl = 20, 15728bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek /** \brief A C++ class method. */ 15738bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek CXCursor_CXXMethod = 21, 15748f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek /** \brief A C++ namespace. */ 15758f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek CXCursor_Namespace = 22, 1576a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek /** \brief A linkage specification, e.g. 'extern "C"'. */ 1577a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek CXCursor_LinkageSpec = 23, 157801829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ constructor. */ 157901829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Constructor = 24, 158001829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ destructor. */ 158101829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Destructor = 25, 158201829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ conversion function. */ 158301829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_ConversionFunction = 26, 1584fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template type parameter. */ 1585fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTypeParameter = 27, 1586fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ non-type template parameter. */ 1587fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_NonTypeTemplateParameter = 28, 1588fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template template parameter. */ 1589fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTemplateParameter = 29, 1590fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ function template. */ 1591fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_FunctionTemplate = 30, 159239d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor /** \brief A C++ class template. */ 159339d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor CXCursor_ClassTemplate = 31, 159474dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor /** \brief A C++ class template partial specialization. */ 159574dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor CXCursor_ClassTemplatePartialSpecialization = 32, 15966931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** \brief A C++ namespace alias declaration. */ 15976931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceAlias = 33, 15980a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor /** \brief A C++ using directive. */ 15990a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor CXCursor_UsingDirective = 34, 1600162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ using declaration. */ 16017e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor CXCursor_UsingDeclaration = 35, 1602162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ alias declaration */ 1603162e1c1b487352434552147967c3dd296ebee2f7Richard Smith CXCursor_TypeAliasDecl = 36, 16047eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@synthesize definition. */ 1605352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCSynthesizeDecl = 37, 16067eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@dynamic definition. */ 1607352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCDynamicDecl = 38, 16082dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis /** \brief An access specifier. */ 16092dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_CXXAccessSpecifier = 39, 161042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 161150aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek CXCursor_FirstDecl = CXCursor_UnexposedDecl, 16122dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, 16131efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1614c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* References */ 1615c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstRef = 40, /* Decl references */ 16161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_ObjCSuperClassRef = 40, 1617c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolRef = 41, 1618c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassRef = 42, 1619c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1620c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A reference to a type declaration. 1621c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1622c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A type reference occurs anywhere where a type is named but not 1623c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * declared. For example, given: 1624c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1625c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \code 1626c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * typedef unsigned size_type; 1627c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * size_type size; 1628c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \endcode 1629c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1630c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The typedef is a declaration of size_type (CXCursor_TypedefDecl), 1631c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * while the type of the variable "size" is referenced. The cursor 1632c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * referenced by the type of size is the typedef for size_type. 1633c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1634c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypeRef = 43, 16353064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CXCursor_CXXBaseSpecifier = 44, 16360b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor /** 1637a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * \brief A reference to a class template, function template, template 1638a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * template parameter, or class template partial specialization. 16390b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor */ 16400b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor CXCursor_TemplateRef = 45, 16416931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** 16426931900f43cea558c6974075256c07728dbfecc6Douglas Gregor * \brief A reference to a namespace or namespace alias. 16436931900f43cea558c6974075256c07728dbfecc6Douglas Gregor */ 16446931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceRef = 46, 1645a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor /** 164636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a member of a struct, union, or class that occurs in 164736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * some non-expression context, e.g., a designated initializer. 1648a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor */ 1649a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor CXCursor_MemberRef = 47, 165036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** 165136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a labeled statement. 165236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 165336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the jump to "start_over" in the 165436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto statement in the following example: 165536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 165636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 165736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 165836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 165936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 166036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto start_over; 166136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 166236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 166336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * A label reference cursor refers to a label statement. 166436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 166536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelRef = 48, 166636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 16671f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor /** 16681f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief A reference to a set of overloaded functions or function templates 16691f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * that has not yet been resolved to a specific function or function template. 16701f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16711f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * An overloaded declaration reference cursor occurs in C++ templates where 16721f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * a dependent name refers to a function. For example: 16731f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16741f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \code 16751f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> void swap(T&, T&); 16761f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16771f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct X { ... }; 16781f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(X&, X&); 16791f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16801f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> 16811f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void reverse(T* first, T* last) { 16821f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * while (first < last - 1) { 16831f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * swap(*first, *--last); 16841f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * ++first; 16851f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 16861f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 16871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct Y { }; 16891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(Y&, Y&); 16901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \endcode 16911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * Here, the identifier "swap" is associated with an overloaded declaration 16931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * reference. In the template definition, "swap" refers to either of the two 16941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * "swap" functions declared above, so both results will be available. At 16951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * instantiation time, "swap" may also refer to other functions found via 16961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * argument-dependent lookup (e.g., the "swap" function at the end of the 16971f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * example). 16981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * The functions \c clang_getNumOverloadedDecls() and 17001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c clang_getOverloadedDecl() can be used to retrieve the definitions 17011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * referenced by this cursor. 17021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 17031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor CXCursor_OverloadedDeclRef = 49, 17041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 1705011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /** 1706011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \brief A reference to a variable that occurs in some non-expression 1707011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * context, e.g., a C++ lambda capture list. 1708011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1709011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_VariableRef = 50, 1710011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1711011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LastRef = CXCursor_VariableRef, 17121efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1713c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Error conditions */ 1714c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstInvalid = 70, 1715c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_InvalidFile = 70, 1716c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NoDeclFound = 71, 1717c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NotImplemented = 72, 1718ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_InvalidCode = 73, 1719ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_LastInvalid = CXCursor_InvalidCode, 17201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1721c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Expressions */ 1722c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstExpr = 100, 17231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1724c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1725c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression whose specific kind is not exposed via this 17261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1727c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1728c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed expressions have the same operations as any other kind 1729c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of expression; one can extract their location information, 1730c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, children, etc. However, the specific kind of the 1731c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * expression is not reported. 1732c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1733c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedExpr = 100, 17341efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1735c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1736c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to some value declaration, such 17376bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * as a function, variable, or enumerator. 1738c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1739c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_DeclRefExpr = 101, 17401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1741c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1742c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to a member of a struct, union, 1743c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * class, Objective-C class, etc. 1744c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1745c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_MemberRefExpr = 102, 17461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1747c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that calls a function. */ 1748c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_CallExpr = 103, 17491efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1750c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that sends a message to an Objective-C 1751c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor object or class. */ 1752c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCMessageExpr = 104, 17531ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 17541ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek /** \brief An expression that represents a block literal. */ 17551ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek CXCursor_BlockExpr = 105, 17561ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 175742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An integer literal. 175842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 175942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IntegerLiteral = 106, 176042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A floating point number literal. 176242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 176342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_FloatingLiteral = 107, 176442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An imaginary number literal. 176642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 176742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ImaginaryLiteral = 108, 176842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A string literal. 177042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 177142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StringLiteral = 109, 177242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 177342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A character literal. 177442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 177542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CharacterLiteral = 110, 177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A parenthesized expression, e.g. "(1)". 177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This AST node is only formed if full location information is requested. 178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ParenExpr = 111, 178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This represents the unary-expression's (except sizeof and 178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * alignof). 178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryOperator = 112, 178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.1] Array Subscripting. 178942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 179042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ArraySubscriptExpr = 113, 179142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 179242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A builtin binary operation expression such as "x + y" or 179342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "x <= y". 179442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 179542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BinaryOperator = 114, 179642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 179742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Compound assignment such as "+=". 179842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 179942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundAssignOperator = 115, 180042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 180142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The ?: ternary operator. 180242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 180342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ConditionalOperator = 116, 180442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 180542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++ 180642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * (C++ [expr.cast]), which uses the syntax (Type)expr. 180742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 180842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * For example: (int)f. 180942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CStyleCastExpr = 117, 181142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 181242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.5] 181342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundLiteralExpr = 118, 181542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 181642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Describes an C or C++ initializer list. 181742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_InitListExpr = 119, 181942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 182042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The GNU address of label extension, representing &&label. 182142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 182242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_AddrLabelExpr = 120, 182342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 182442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This is the GNU Statement Expression extension: ({int X=4; X;}) 182542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 182642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StmtExpr = 121, 182742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1828ffbe9b9c64ab2e94b9d48ec56e511f75826fc80aBenjamin Kramer /** \brief Represents a C11 generic selection. 182942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 183042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GenericSelectionExpr = 122, 183142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 183242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Implements the GNU __null extension, which is a name for a null 183342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pointer constant that has integral type (e.g., int or long) and is the same 183442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * size and alignment as a pointer. 183542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 183642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * The __null extension is typically only used by system headers, which define 183742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NULL as __null in C++ rather than using 0 (which is an integer that may not 183842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * match the size of a pointer). 183942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GNUNullExpr = 123, 184142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 184242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s static_cast<> expression. 184342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXStaticCastExpr = 124, 184542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 184642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s dynamic_cast<> expression. 184742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 184842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDynamicCastExpr = 125, 184942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s reinterpret_cast<> expression. 185142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 185242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXReinterpretCastExpr = 126, 185342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s const_cast<> expression. 185542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 185642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXConstCastExpr = 127, 185742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an explicit C++ type conversion that uses "functional" 185942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * notion (C++ [expr.type.conv]). 186042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 186142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Example: 186242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 186342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * x = int(0.5); 186442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 186542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 186642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXFunctionalCastExpr = 128, 186742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 186842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A C++ typeid expression (C++ [expr.typeid]). 186942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 187042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTypeidExpr = 129, 187142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 187242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 2.13.5] C++ Boolean Literal. 187342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 187442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXBoolLiteralExpr = 130, 187542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 187642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++0x 2.14.7] C++ Pointer Literal. 187742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 187842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNullPtrLiteralExpr = 131, 187942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 188042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents the "this" expression in C++ 188142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 188242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThisExpr = 132, 188342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 188442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 15] C++ Throw Expression. 188542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 188642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This handles 'throw' and 'throw' assignment-expression. When 188742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * assignment-expression isn't present, Op will be null. 188842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 188942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThrowExpr = 133, 189042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 189142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A new expression for memory allocation and constructor calls, e.g: 189242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "new CXXNewExpr(foo)". 189342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 189442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNewExpr = 134, 189542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 189642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A delete expression for memory deallocation and destructor calls, 189742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * e.g. "delete[] pArray". 189842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 189942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDeleteExpr = 135, 190042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 190142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A unary expression. 190242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 190342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryExpr = 136, 190442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19059793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C string literal i.e. @"foo". 190642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 190742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCStringLiteral = 137, 190842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19097eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@encode expression. 191042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCEncodeExpr = 138, 191242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19137eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@selector expression. 191442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCSelectorExpr = 139, 191642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191717d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@protocol expression. 191842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCProtocolExpr = 140, 192042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 192142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An Objective-C "bridged" cast expression, which casts between 192242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Objective-C pointers and C pointers, transferring ownership in the process. 192342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 192442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 192542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NSString *str = (__bridge_transfer NSString *)CFCreateString(); 192642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 192742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCBridgedCastExpr = 141, 192942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents a C++0x pack expansion that produces a sequence of 193142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 193242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 193342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * A pack expansion expression contains a pattern (which itself is an 193442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expression) followed by an ellipsis. For example: 193542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 193642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 193742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename F, typename ...Types> 193842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * void forward(F f, Types &&...args) { 193942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * f(static_cast<Types&&>(args)...); 194042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * } 194142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 194242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_PackExpansionExpr = 142, 194442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 194542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an expression that computes the length of a parameter 194642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pack. 194742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 194842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 194942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename ...Types> 195042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * struct count { 195142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * static const unsigned value = sizeof...(Types); 195242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * }; 195342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 195442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 195542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SizeOfPackExpr = 143, 195642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1957011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /* \brief Represents a C++ lambda expression that produces a local function 1958011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * object. 1959011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * 1960011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \code 1961011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * void abssort(float *x, unsigned N) { 1962011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * std::sort(x, x + N, 1963011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * [](float a, float b) { 1964011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * return std::abs(a) < std::abs(b); 1965011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * }); 1966011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * } 1967011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \endcode 1968011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1969011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LambdaExpr = 144, 1970011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1971b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek /** \brief Objective-c Boolean Literal. 1972b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek */ 1973b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek CXCursor_ObjCBoolLiteralExpr = 145, 1974b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek 19756bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines /** \brief Represents the "self" expression in an Objective-C method. 1976edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis */ 1977edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis CXCursor_ObjCSelfExpr = 146, 1978edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis 1979edab047e10d745a65d12c8cb36be2ba9e96c9e0eArgyrios Kyrtzidis CXCursor_LastExpr = CXCursor_ObjCSelfExpr, 19801efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1981c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Statements */ 1982c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstStmt = 200, 1983c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1984c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A statement whose specific kind is not exposed via this 1985c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * interface. 1986c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1987c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed statements have the same operations as any other kind of 1988c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * statement; one can extract their location information, spelling, 1989c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * children, etc. However, the specific kind of the statement is not 1990c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reported. 1991c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1992c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedStmt = 200, 199336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 199436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** \brief A labelled statement in a function. 199536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 199636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the "start_over:" label statement in 199736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * the following example: 199836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 199936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 200036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 200136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 200236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 200336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 200436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 200536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelStmt = 201, 200642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 200742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A group of statements like { stmt stmt }. 200842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 200942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe compound statements, e.g. function 201042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * bodies. 201142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 201242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundStmt = 202, 201342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 2014063820655db8121f0022a7c51458463c7250324cBenjamin Kramer /** \brief A case statement. 201542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 201642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CaseStmt = 203, 201742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 201842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A default statement. 201942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 202042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DefaultStmt = 204, 202142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 202242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An if statement 202342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 202442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IfStmt = 205, 202542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 202642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A switch statement. 202742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 202842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SwitchStmt = 206, 202942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 203042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A while statement. 203142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 203242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_WhileStmt = 207, 203342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 203442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A do statement. 203542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 203642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DoStmt = 208, 203742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 203842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A for statement. 203942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 204042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ForStmt = 209, 204142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 204242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A goto statement. 204342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 204442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GotoStmt = 210, 204542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 204642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An indirect goto statement. 204742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 204842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IndirectGotoStmt = 211, 204942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 205042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A continue statement. 205142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 205242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ContinueStmt = 212, 205342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 205442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A break statement. 205542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 205642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BreakStmt = 213, 205742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 205842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A return statement. 205942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 206042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ReturnStmt = 214, 206142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 2062df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier /** \brief A GCC inline assembly statement extension. 206342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 2064df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier CXCursor_GCCAsmStmt = 215, 20655e02f6525d109c42650575c352bd2fdb14ed4193Argyrios Kyrtzidis CXCursor_AsmStmt = CXCursor_GCCAsmStmt, 206642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20677eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's overall \@try-\@catch-\@finally statement. 206842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 206942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtTryStmt = 216, 207042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20717eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@catch statement. 207242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 207342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtCatchStmt = 217, 207442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20757eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@finally statement. 207642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 207742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtFinallyStmt = 218, 207842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20797eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@throw statement. 208042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 208142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtThrowStmt = 219, 208242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20837eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@synchronized statement. 208442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 208542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtSynchronizedStmt = 220, 208642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 208742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's autorelease pool statement. 208842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 208942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAutoreleasePoolStmt = 221, 209042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 209142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's collection statement. 209242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 209342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCForCollectionStmt = 222, 209442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 209542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s catch statement. 209642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 209742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXCatchStmt = 223, 209842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 209942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s try statement. 210042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 210142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTryStmt = 224, 210242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 210342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s for (* : *) statement. 210442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 210542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXForRangeStmt = 225, 210642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 210742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's try statement. 210842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 210942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHTryStmt = 226, 211042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 211142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's except statement. 211242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 211342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHExceptStmt = 227, 211442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 211542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's finally statement. 211642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 211742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHFinallyStmt = 228, 211842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 21198cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier /** \brief A MS inline assembly statement extension. 21208cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier */ 21218cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier CXCursor_MSAsmStmt = 229, 21228cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier 212342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The null satement ";": C99 6.8.3p3. 212442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 212542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe the null statement. 212642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 212742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_NullStmt = 230, 212842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 212942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Adaptor class for mixing declarations with statements and 213042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 213142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 213242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DeclStmt = 231, 213342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 21344fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev /** \brief OpenMP parallel directive. 21354fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev */ 21364fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev CXCursor_OMPParallelDirective = 232, 21374fa7eab771ab8212e1058bd1a91061ff120c8fbbAlexey Bataev 2138651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines /** \brief OpenMP simd directive. 2139651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 2140651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines CXCursor_OMPSimdDirective = 233, 2141651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 2142ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP for directive. 2143ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2144ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPForDirective = 234, 2145ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2146ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP sections directive. 2147ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2148ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPSectionsDirective = 235, 2149ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2150ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP section directive. 2151ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2152ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPSectionDirective = 236, 2153ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2154ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP single directive. 2155ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2156ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPSingleDirective = 237, 2157ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2158ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP parallel for directive. 2159ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2160ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPParallelForDirective = 238, 2161ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2162ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief OpenMP parallel sections directive. 2163ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2164ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_OMPParallelSectionsDirective = 239, 2165ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2166ef8225444452a1486bd721f3285301fe84643b00Stephen Hines /** \brief Windows Structured Exception Handling's leave statement. 2167ef8225444452a1486bd721f3285301fe84643b00Stephen Hines */ 2168ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_SEHLeaveStmt = 240, 2169ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 2170ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_LastStmt = CXCursor_SEHLeaveStmt, 21711efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2172c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 2173c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Cursor that represents the translation unit itself. 2174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor exists primarily to act as the root 2176c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor for traversing the contents of a translation unit. 2177c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2178e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_TranslationUnit = 300, 2179e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 2180ad017fa7a4df7389d245d02a49b3c79ed70bedb9Bill Wendling /* Attributes */ 2181e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_FirstAttr = 400, 2182e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek /** 2183e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * \brief An attribute whose specific kind is not exposed via this 2184e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * interface. 2185e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek */ 2186e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_UnexposedAttr = 400, 2187e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 2188e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBActionAttr = 401, 2189e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBOutletAttr = 402, 2190857e918a8a40deb128840308a318bf623d68295fTed Kremenek CXCursor_IBOutletCollectionAttr = 403, 21916639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXFinalAttr = 404, 21926639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXOverrideAttr = 405, 21935f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen CXCursor_AnnotateAttr = 406, 219484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCursor_AsmLabelAttr = 407, 2195513371129c834c143a50c3ca09bb581b7f0f6344Argyrios Kyrtzidis CXCursor_PackedAttr = 408, 21966bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines CXCursor_PureAttr = 409, 21976bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines CXCursor_ConstAttr = 410, 21986bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines CXCursor_NoDuplicateAttr = 411, 2199ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_CUDAConstantAttr = 412, 2200ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_CUDADeviceAttr = 413, 2201ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_CUDAGlobalAttr = 414, 2202ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_CUDAHostAttr = 415, 2203ef8225444452a1486bd721f3285301fe84643b00Stephen Hines CXCursor_LastAttr = CXCursor_CUDAHostAttr, 2204ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 22059f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor /* Preprocessing */ 22069f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_PreprocessingDirective = 500, 2207572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor CXCursor_MacroDefinition = 501, 22089b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroExpansion = 502, 22099b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroInstantiation = CXCursor_MacroExpansion, 2210ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor CXCursor_InclusionDirective = 503, 22119f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, 22126a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_LastPreprocessing = CXCursor_InclusionDirective, 22136a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis 22146a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis /* Extra Declarations */ 22156a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis /** 22166a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis * \brief A module import declaration. 22176a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis */ 22186a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_ModuleImportDecl = 600, 22196a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, 22206a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl 2221c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 2222c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2223c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for 2225c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit. 2226c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 22271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a 2228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations, 2229c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations. 2230c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in 2231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a 2232c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor. 2233c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2234c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways. 2235c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit, 2236c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the 2237c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location 2238c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the 2239c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST. 2240c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2241c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct { 2242c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor enum CXCursorKind kind; 2243aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis int xdata; 224467812b2f94f4b5e7d2596db1705ffa1149ddc45aDmitri Gribenko const void *data[3]; 22451efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor; 2246c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2247c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2248c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations 2249c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2250c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2251c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 22521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2253c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2254c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity. 2255c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2256c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void); 22571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2258c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2259c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit. 2260c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2261c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the 2262c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit. 2263c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2264c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); 2265c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2266c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2267c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent. 2268c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2269c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); 22701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2271c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 22721824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p cursor is null. 2273b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 22741824d54df85a462ada812dadda18130f951d40f3Dmitri GribenkoCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); 2275b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2276b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 22779ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor. 22789ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */ 22799ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); 22809ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor 22819ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/** 2282c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor. 2283c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2284c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); 2285c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2286c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2287c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration. 2288c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2289c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); 2290c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2291c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2292c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple 2293c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference. 2294c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2295c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to 2296c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a 2297c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity. 2298c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2299c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); 2300c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2301c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2302c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression. 2303c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2304c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); 2305c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2306c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2307c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement. 2308c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2309c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); 2310c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2311c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 23128be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute. 23138be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */ 23148be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); 23158be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor 23168be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/** 23171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid 2318c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor. 23191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */ 2320c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); 2321c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2322c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 23231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation 23241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit. 2325c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2326c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); 23271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2328ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/*** 23299f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing 23309f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation. 23319f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */ 23329f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); 23339f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor 23349f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/*** 2335ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently 2336ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). 2337ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */ 2338ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); 2339ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek 2340c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 234116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor. 234216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 234316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind { 234416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This value indicates that no linkage information is available 234516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * for a provided CXCursor. */ 234616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Invalid, 234716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** 234816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief This is the linkage for variables, parameters, and so on that 234916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * have automatic storage. This covers normal (non-extern) local variables. 235016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 235116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_NoLinkage, 235216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for static variables and static functions. */ 235316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Internal, 235416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with external linkage that live 235516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * in C++ anonymous namespaces.*/ 235616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_UniqueExternal, 235716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with true, external linkage. */ 235816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_External 235916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek}; 236016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 236116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 236245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor. 236316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 236416b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); 236516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 236616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 2367cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to, 2368cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * taking the current target platform into account. 236958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 237058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query. 237158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 237258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor. 237358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 237458ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 237558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor); 237658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 237758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 2378cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Describes the availability of a given entity on a particular platform, e.g., 2379cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * a particular class might only be available on Mac OS 10.7 or newer. 2380cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2381cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXPlatformAvailability { 2382cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2383cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief A string that describes the platform for which this structure 2384cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provides availability information. 2385cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2386cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Possible values are "ios" or "macosx". 2387cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2388cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString Platform; 2389cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2390cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was introduced. 2391cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2392cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Introduced; 2393cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2394cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was deprecated (but is 2395cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * still available). 2396cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2397cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Deprecated; 2398cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2399cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was obsoleted, and therefore 2400cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is no longer available. 2401cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2402cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Obsoleted; 2403cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2404cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Whether the entity is unconditionally unavailable on this platform. 2405cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2406cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int Unavailable; 2407cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2408cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief An optional message to provide to a user of this API, e.g., to 2409cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * suggest replacement APIs. 2410cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2411cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString Message; 2412cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXPlatformAvailability; 2413cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2414cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 2415cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to 2416cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * on any platforms for which availability information is known. 2417cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2418cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param cursor The cursor to query. 2419cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2420cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param always_deprecated If non-NULL, will be set to indicate whether the 2421cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is deprecated on all platforms. 2422cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2423cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param deprecated_message If non-NULL, will be set to the message text 2424cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional deprecation of this entity. The client 2425cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is responsible for deallocating this string. 2426cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 24277eee0184570366285589d788bcd7f5dda8345915James Dennett * \param always_unavailable If non-NULL, will be set to indicate whether the 2428cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is unavailable on all platforms. 2429cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2430cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param unavailable_message If non-NULL, will be set to the message text 2431cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional unavailability of this entity. The 2432cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * client is responsible for deallocating this string. 2433cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2434cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability If non-NULL, an array of CXPlatformAvailability instances 2435cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * that will be populated with platform availability information, up to either 2436cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * the number of platforms for which availability information is available (as 2437cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * returned by this function) or \c availability_size, whichever is smaller. 2438cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2439cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability_size The number of elements available in the 2440cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c availability array. 2441cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2442cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \returns The number of platforms (N) for which availability information is 2443cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * available (which is unrelated to \c availability_size). 2444cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2445cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Note that the client is responsible for calling 2446cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c clang_disposeCXPlatformAvailability to free each of the 2447cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * platform-availability structures returned. There are 2448cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c min(N, availability_size) such structures. 2449cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2450cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE int 2451cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_getCursorPlatformAvailability(CXCursor cursor, 2452cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int *always_deprecated, 2453cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString *deprecated_message, 2454cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int *always_unavailable, 2455cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString *unavailable_message, 2456cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXPlatformAvailability *availability, 2457cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int availability_size); 2458cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2459cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 2460cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Free the memory associated with a \c CXPlatformAvailability structure. 2461cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2462cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE void 2463cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); 2464cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2465cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 246645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor. 246745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 2468651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinesenum CXLanguageKind { 24696cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_Invalid = 0, 247045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_C, 247145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_ObjC, 24726cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_CPlusPlus 247345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek}; 247445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 247545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 247645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor. 247745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 247845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); 247945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 2480b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 2481b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from. 2482b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 2483b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); 2484b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2485017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 2486017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/** 2487017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief A fast container representing a set of CXCursors. 2488017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */ 2489017dd74979c74c8950f733938953b98cfa250478Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet; 2490017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 2491017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/** 2492017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Creates an empty CXCursorSet. 2493017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */ 2494017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); 2495017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 2496017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/** 2497017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory. 2498017dd74979c74c8950f733938953b98cfa250478Ted Kremenek */ 2499017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); 2500017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 2501017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/** 2502017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor. 2503017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * 2504017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \returns non-zero if the set contains the specified cursor. 2505017dd74979c74c8950f733938953b98cfa250478Ted Kremenek*/ 2506017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, 2507017dd74979c74c8950f733938953b98cfa250478Ted Kremenek CXCursor cursor); 2508017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 2509017dd74979c74c8950f733938953b98cfa250478Ted Kremenek/** 2510017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet. 2511017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * 2512017dd74979c74c8950f733938953b98cfa250478Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise. 2513017dd74979c74c8950f733938953b98cfa250478Ted Kremenek*/ 2514017dd74979c74c8950f733938953b98cfa250478Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, 2515017dd74979c74c8950f733938953b98cfa250478Ted Kremenek CXCursor cursor); 2516017dd74979c74c8950f733938953b98cfa250478Ted Kremenek 25172be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 25182be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor. 25192be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25202be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains 25212be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents 25222be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by 25232be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or 25242be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 25252be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25262be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 25272be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 25282be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 25292be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 25302be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25312be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 25322be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 25332be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25346bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * In the out-of-line definition of \c C::f, the semantic parent is 25352be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 25362be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 25376bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * case, the definition occurs in the translation unit. In general, the 25382be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 25392be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 25402be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 25412be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 25422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 25432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 25452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 25462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 25473910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 25483910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit. 25492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 25502be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); 25512be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor 25522be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 25532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor. 25542be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25552be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor 25562be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents 25572be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by 25582be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or 25592be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 25602be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25612be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 25622be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 25632be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 25642be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 25652be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25662be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 25672be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 25682be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25696bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * In the out-of-line definition of \c C::f, the semantic parent is 25702be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 25712be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 25726bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * case, the definition occurs in the translation unit. In general, the 25732be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 25742be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 25752be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 25762be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 25772be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 25782be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 25792be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 25802be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 25812be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 25823910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 25833910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is 25843910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit. 25852be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 25862be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); 25879f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 25889f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 25899f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given 25909f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. 25919f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 25929f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function, 25939f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For 25949f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's 2595044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * base class, its protocols, or its categories' protocols, that has the same 2596044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * selector and is of the same kind (class or instance). 2597044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * If no such method exists, the search continues to the class's superclass, 2598044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * its protocols, and its categories, and so on. A method from an Objective-C 2599044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * implementation is considered to override the same methods as its 2600044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * corresponding method in the interface. 26019f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 26029f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member 26039f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base 26049f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can 26059f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different 26069f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes. 26079f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 26089f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden 26099f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if 26109f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B 26119f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B), 26129f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when 26139f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then 26149f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden 26159f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set. 26169f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 26179f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++ 26189f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this 26199f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides. 26209f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 26219f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a 26229f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden 26239f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be 26249f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to 26259f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors(). 26269f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 26279f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden 26289f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the 26299f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden. 26309f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 26319f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 26329f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor CXCursor **overridden, 26339f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor unsigned *num_overridden); 26349f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 26359f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 26369f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c 26379f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors(). 26389f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 26399f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); 26409f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 264145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 2642ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive 2643ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor. 2644ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */ 2645ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); 2646ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor 2647ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/** 2648c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2649c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 26501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2651c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2652c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code 2653c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2654c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These 2655c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the 2656c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in 2657c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back. 2658c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2659c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 266050398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */ 26611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 26626a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/** 2663b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that 2664b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code. 2665b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2666b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation 2667b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that 26681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking 2669b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the 26701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between 2671b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() 2672b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression. 2673b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2674b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or 2675b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found. 26766a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */ 2677b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); 26781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 267998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/** 268098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced 268198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor. 268298258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * 268398258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that 26841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is 26851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration. 26861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the 268798258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code. 268898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */ 268998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); 2690c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2691b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/** 2692b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by 2693a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor. 2694a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * 2695a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the 2696a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and 26976bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * ends with the last character within that source construct. For a 2698a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference, 2699a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced 2700a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used). 2701a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */ 2702a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); 2703c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor 2704c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2705c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2706c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 270795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 2708c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 27098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors 27108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 27118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{ 27128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 27158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type 27168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind { 27188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 27196bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Represents an invalid type (e.g., where no type is available). 27208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Invalid = 0, 27228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 27248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief A type whose specific kind is not exposed via this 27258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * interface. 27268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Unexposed = 1, 27288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /* Builtin types */ 27308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Void = 2, 27318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Bool = 3, 27328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_U = 4, 27338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UChar = 5, 27348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char16 = 6, 27358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char32 = 7, 27368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UShort = 8, 27378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt = 9, 27388e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULong = 10, 27398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULongLong = 11, 27408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt128 = 12, 27418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_S = 13, 27428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_SChar = 14, 27438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_WChar = 15, 27448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Short = 16, 27458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int = 17, 27468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Long = 18, 27478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongLong = 19, 27488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int128 = 20, 27498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Float = 21, 27508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Double = 22, 27518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongDouble = 23, 27528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_NullPtr = 24, 27538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Overload = 25, 27548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Dependent = 26, 27558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCId = 27, 27568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCClass = 28, 27578e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCSel = 29, 27588e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_FirstBuiltin = CXType_Void, 27598e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LastBuiltin = CXType_ObjCSel, 27608e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27618e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Complex = 100, 27628e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Pointer = 101, 27638e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_BlockPointer = 102, 27648e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LValueReference = 103, 27658e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_RValueReference = 104, 27668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Record = 105, 27678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Enum = 106, 27688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Typedef = 107, 27698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCInterface = 108, 277004c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_ObjCObjectPointer = 109, 277104c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_FunctionNoProto = 110, 27725f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis CXType_FunctionProto = 111, 277384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXType_ConstantArray = 112, 27744c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis CXType_Vector = 113, 27754c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis CXType_IncompleteArray = 114, 27764c4f6fe2a6d6b3ffd0ce114cb8099366662b67f7Argyrios Kyrtzidis CXType_VariableArray = 115, 2777367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis CXType_DependentSizedArray = 116, 2778367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis CXType_MemberPointer = 117 27798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek}; 27808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 278284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type 278384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 278484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv { 278584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Default = 0, 278684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_C = 1, 278784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86StdCall = 2, 278884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86FastCall = 3, 278984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86ThisCall = 4, 279084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86Pascal = 5, 279184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS = 6, 279284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS_VFP = 7, 2793263366f9241366f29ba65b703120f302490c39ffDerek Schuff CXCallingConv_PnaclCall = 8, 279438980086c0f791e8c23cc882574f18e5b4a87db6Guy Benyei CXCallingConv_IntelOclBicc = 9, 2795e8519c31a6ef853b627d557702ac1890f18ce2c9Charles Davis CXCallingConv_X86_64Win64 = 10, 2796e8519c31a6ef853b627d557702ac1890f18ce2c9Charles Davis CXCallingConv_X86_64SysV = 11, 279784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 279884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Invalid = 100, 279984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Unexposed = 200 280084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis}; 280184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 280284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 280384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 28048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree. 28058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 28068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 28078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct { 28088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek enum CXTypeKind kind; 28098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek void *data[2]; 28108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType; 28118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 28128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 28138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any). 28148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 28158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); 28168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 28178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 2818ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * \brief Pretty-print the underlying type using the rules of the 2819ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * language of the translation unit from which it came. 2820ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * 2821ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko * If the type is invalid, an empty string is returned. 2822ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko */ 2823ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri GribenkoCINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT); 2824ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko 2825ae03d8e52d81adbb98b31dd5c179abe45c91fc25Dmitri Gribenko/** 282684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration. 282784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 282884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is 282984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 283084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 283184b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); 283284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 283384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 283484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration. 283584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 283684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is 283784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 283884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 283984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); 284084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 284184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 284284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed 284384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 284484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 284584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. 284684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 284784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 284884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 284984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); 285084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 285184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 285284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned 285384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 285484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 285584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. 285684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 285784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 285884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 285984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); 286084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 286184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 28621eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * \brief Retrieve the bit width of a bit field declaration as an integer. 28631eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * 28641eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * If a cursor that is not a bit field declaration is passed in, -1 is returned. 28651eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko */ 28661eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri GribenkoCINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); 28671eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko 28681eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko/** 2869d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a given 2870d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * cursor. 2871d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * 2872e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The number of arguments can be determined for calls as well as for 2873e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * declarations of functions or methods. For other cursors -1 is returned. 2874d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */ 2875d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); 2876d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis 2877d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/** 2878d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the argument cursor of a function or method. 2879d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * 2880e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * The argument cursor can be determined for calls as well as for declarations 2881e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * of functions or methods. For other cursors and for invalid indices, an 2882e9ebd852ec1effa393bcc4aad73d9c657a5279c1Argyrios Kyrtzidis * invalid cursor is returned. 2883d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */ 2884d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); 2885d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis 2886d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/** 28877eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two CXTypes represent the same type. 28888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 28897eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns non-zero if the CXTypes represent the same type and 28907eee0184570366285589d788bcd7f5dda8345915James Dennett * zero otherwise. 28918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 28928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); 28938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 28948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 28958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType. 28968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 28978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways 28988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented. The canonical type is the underlying 28998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed. For example, if 'T' is a typedef 29008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'. 29018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 29028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); 29038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 29057eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "const" qualifier set, 29067eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "const" at a 29077eee0184570366285589d788bcd7f5dda8345915James Dennett * different level. 2908e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2909e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); 2910e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2911e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 29127eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "volatile" qualifier set, 29137eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "volatile" at 29147eee0184570366285589d788bcd7f5dda8345915James Dennett * a different level. 2915e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2916e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); 2917e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2918e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 29197eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "restrict" qualifier set, 29207eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "restrict" at a 29217eee0184570366285589d788bcd7f5dda8345915James Dennett * different level. 2922e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2923e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); 2924e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2925e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 29268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee. 29278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 29288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T); 29298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 29318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type. 29328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 29338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); 29348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29355389f48b24937ad7b4093307128b3cbf25235654David Chisnall/** 29365389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration. 29375389f48b24937ad7b4093307128b3cbf25235654David Chisnall */ 29385389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); 29398e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 29418e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind. 29428e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 29438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); 29448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 294684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type. 294784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 294884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned. 294984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 295084b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); 295184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 295284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 2953651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Retrieve the return type associated with a function type. 295484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 295584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned. 295604c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */ 295704c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T); 295804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek 295904c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/** 2960651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Retrieve the number of non-variadic parameters associated with a 29617eee0184570366285589d788bcd7f5dda8345915James Dennett * function type. 296284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 2963d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a non-function type is passed in, -1 is returned. 296484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 2965d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_getNumArgTypes(CXType T); 296684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 296784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 2968651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Retrieve the type of a parameter of a function type. 296984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 29707eee0184570366285589d788bcd7f5dda8345915James Dennett * If a non-function type is passed in or the function does not have enough 29717eee0184570366285589d788bcd7f5dda8345915James Dennett * parameters, an invalid type is returned. 297284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 297384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); 297484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 297584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 297684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise. 297784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 297884b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); 297984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 298084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 2981651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Retrieve the return type associated with a given cursor. 298284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 298384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method. 29849a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */ 29859a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); 29869a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek 29879a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/** 29883ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0 29893ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * otherwise. 29903ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */ 29913ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T); 29923ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek 29933ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/** 299484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type. 299584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 299684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type, 299784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned. 299884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 299984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T); 300084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 300184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 300284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type. 300384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 300484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type, 300584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned. 300684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 300784b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T); 300884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 300984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 30105f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type. 30115f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 30125f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned. 30135f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 30145f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); 30155f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 30165f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 3017bed28ac1d1463adca3ecf24fca5c30646fa9dbb2Sylvestre Ledru * \brief Return the array size of a constant array. 30185f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 30195f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned. 30205f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 30215f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T); 30225f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 30235f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 3024411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief List the possible error codes for \c clang_Type_getSizeOf, 3025411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \c clang_Type_getAlignOf, \c clang_Type_getOffsetOf and 3026411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \c clang_Cursor_getOffsetOf. 3027411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * 3028411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * A value of this enumeration type can be returned if the target type is not 3029411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * a valid argument to sizeof, alignof or offsetof. 3030411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3031411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidisenum CXTypeLayoutError { 3032411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis /** 3033411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Type is of kind CXType_Invalid. 3034411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3035411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis CXTypeLayoutError_Invalid = -1, 3036411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis /** 3037411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief The type is an incomplete Type. 3038411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3039411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis CXTypeLayoutError_Incomplete = -2, 3040411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis /** 3041411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief The type is a dependent Type. 3042411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3043411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis CXTypeLayoutError_Dependent = -3, 3044411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis /** 3045411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief The type is not a constant size type. 3046411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3047411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis CXTypeLayoutError_NotConstantSize = -4, 3048411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis /** 3049411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief The Field name is not valid for this record. 3050411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3051411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis CXTypeLayoutError_InvalidFieldName = -5 3052411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis}; 3053411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis 3054411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/** 3055411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the alignment of a type in bytes as per C++[expr.alignof] 3056411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * standard. 3057411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * 3058411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 3059411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 3060411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * is returned. 3061411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 3062411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * returned. 3063411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is not a constant size type, 3064411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * CXTypeLayoutError_NotConstantSize is returned. 3065411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3066411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getAlignOf(CXType T); 3067411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis 3068411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/** 3069367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis * \brief Return the class type of an member pointer type. 3070367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis * 3071367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis * If a non-member-pointer type is passed in, an invalid type is returned. 3072367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis */ 3073367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_Type_getClassType(CXType T); 3074367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis 3075367e8fe3ef5bcf5e3c9855364560b89f7a1e9145Argyrios Kyrtzidis/** 3076411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the size of a type in bytes as per C++[expr.sizeof] standard. 3077411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * 3078411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is invalid, CXTypeLayoutError_Invalid is returned. 3079411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is an incomplete type, CXTypeLayoutError_Incomplete 3080411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * is returned. 3081411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the type declaration is a dependent type, CXTypeLayoutError_Dependent is 3082411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * returned. 3083411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3084411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getSizeOf(CXType T); 3085411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis 3086411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/** 3087411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Return the offset of a field named S in a record of type T in bits 3088411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * as it would be returned by __offsetof__ as per C++11[18.2p4] 3089411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * 3090411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the cursor is not a record field declaration, CXTypeLayoutError_Invalid 3091411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * is returned. 3092411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is an incomplete type, 3093411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * CXTypeLayoutError_Incomplete is returned. 3094411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's type declaration is a dependent type, 3095411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * CXTypeLayoutError_Dependent is returned. 3096411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * If the field's name S is not found, 3097411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * CXTypeLayoutError_InvalidFieldName is returned. 3098411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3099411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE long long clang_Type_getOffsetOf(CXType T, const char *S); 3100411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis 3101659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidisenum CXRefQualifierKind { 3102659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis /** \brief No ref-qualifier was provided. */ 3103659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis CXRefQualifier_None = 0, 3104659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis /** \brief An lvalue ref-qualifier was provided (\c &). */ 3105659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis CXRefQualifier_LValue, 3106659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis /** \brief An rvalue ref-qualifier was provided (\c &&). */ 3107659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis CXRefQualifier_RValue 3108659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis}; 3109659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis 3110659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis/** 3111651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Returns the number of template arguments for given class template 3112651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * specialization, or -1 if type \c T is not a class template specialization. 3113651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 3114651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * Variadic argument packs count as only one argument, and can not be inspected 3115651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * further. 3116651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 3117651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE int clang_Type_getNumTemplateArguments(CXType T); 3118651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 3119651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 3120651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \brief Returns the type template argument of a template class specialization 3121651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * at given index. 3122651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * 3123651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * This function only returns template type arguments and does not handle 3124651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * template template arguments or variadic packs. 3125651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines */ 3126651f13cea278ec967336033dd032faef0e9fc2ecStephen HinesCINDEX_LINKAGE CXType clang_Type_getTemplateArgumentAsType(CXType T, unsigned i); 3127651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines 3128651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/** 3129659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis * \brief Retrieve the ref-qualifier kind of a function or method. 3130659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis * 3131659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis * The ref-qualifier is returned for C++ functions or methods. For other types 3132659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis * or non-C++ declarations, CXRefQualifier_None is returned. 3133659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis */ 3134659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios KyrtzidisCINDEX_LINKAGE enum CXRefQualifierKind clang_Type_getCXXRefQualifier(CXType T); 3135659837e0ce0f73c7fdd5941854be3500db2f4013Argyrios Kyrtzidis 3136411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/** 3137411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * \brief Returns non-zero if the cursor specifies a Record member that is a 3138411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis * bitfield. 3139411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis */ 3140411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isBitField(CXCursor C); 3141411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis 3142411d33aa0b0d3bc9b2faec40cd821bdd836094abArgyrios Kyrtzidis/** 31433064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind 31443064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * CX_CXXBaseSpecifier is virtual. 31453064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 31463064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); 31473064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 31483064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 31493064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a 31503064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier. 31513064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 31523064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier { 31533064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXInvalidAccessSpecifier, 31543064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPublic, 31553064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXProtected, 31563064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPrivate 31573064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek}; 31583064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 31593064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 316004b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * \brief Returns the access control level for the referenced object. 31615142be6b38f44f3c08a93c7b034b3b527ac702c1Argyrios Kyrtzidis * 316204b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * If the cursor refers to a C++ declaration, its access control level within its 316304b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * parent scope is returned. Otherwise, if the cursor refers to a base specifier or 316404b6748ee90649069ee79464317ae6cd6aca317dArgyrios Kyrtzidis * access specifier, the specifier itself is returned. 31653064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 31663064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); 31673064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 31683064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 31691f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a 31701f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor. 31711f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 31721f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 31731f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 31741f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it 31751f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. 31761f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 31771f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); 31781f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 31791f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 31801f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced 31811f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor. 31821f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 31831f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 31841f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 31851f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in 31861f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor. 31871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 31881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given 31891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an 31901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds, 31911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor(); 31921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 31931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 31941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor unsigned index); 31951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 31961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 31978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @} 31988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 319995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 320095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 3201ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes 320295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 320395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{ 320495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 320595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 320695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 320795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 320895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute, 320995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * this function returns the collection element type. 321095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 321195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 321295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); 321395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 321495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 321595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @} 321695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 32178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 32188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 3219c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors 3220c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3221c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree 3222c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors. 3223c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3224c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3225c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 32261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3227c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3228c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular 3229c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor. 3230c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3231c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each 3232c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. 3233c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3234c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult { 3235c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 32361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Terminates the cursor traversal. 3237c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3238c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Break, 32391efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 3240c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Continues the cursor traversal with the next sibling of 3241c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the cursor just visited, without visiting its children. 3242c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3243c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Continue, 3244c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 3245c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Recursively traverse the children of this cursor, using 3246c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the same visitor and client data. 3247c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3248c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Recurse 3249c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 3250c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3251c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3252c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal. 3253c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3254c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by 3255c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being 3256c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor, 3257c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to 3258c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). 3259c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3260c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values 3261c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren(). 3262c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 32631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, 32641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor parent, 3265c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 3266c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3267c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3268c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor. 3269c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3270c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor, 3271c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each 3272c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns 3273c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if 3274c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break. 3275c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3276c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of 3277a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by 3278c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children). 3279c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3280c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each 3281c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent. 3282c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3283c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will 3284c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked. 3285c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3286c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated 3287c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break. 3288c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 32891efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, 3290c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursorVisitor visitor, 3291c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 32923387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature 32933387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# if __has_feature(blocks) 32943387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 32953387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal. 32963387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 32973387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by 32983387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being 32993387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor. 33003387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 33013387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values 33023387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock(). 33033387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 33043387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult 33053387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); 33063387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall 33073387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 33083387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block. Behaves 33093387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects. 33103387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 33113387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent, 33123387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall CXCursorVisitorBlock block); 33133387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# endif 33143387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif 33151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3316c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3317c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3318c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 33191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3320c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3321c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST 3322c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 33231efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and 3324c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced 3325c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference, 3326c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions. 3327c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3328c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3329c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 33301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3331c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3332c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced 3333c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor. 3334c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3335c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular 3336c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be 3337c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in 3338c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit. 3339c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3340c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); 3341c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3342c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3343896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class. 3344896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3345896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); 3346896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3347896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3348896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category. 3349896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3350896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 335166ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek clang_constructUSR_ObjCCategory(const char *class_name, 3352896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek const char *category_name); 3353896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3354896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3355896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol. 3356896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3357896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 3358896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek clang_constructUSR_ObjCProtocol(const char *protocol_name); 3359896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3360896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3361896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3362896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and 3363896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 3364896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3365896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, 3366896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3367896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3368896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3369896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and 3370896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 3371896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3372896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, 3373896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek unsigned isInstanceMethod, 3374896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3375896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3376896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3377896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR 3378896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * for its containing class. 3379896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3380896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, 3381896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3382896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3383896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3384c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor. 3385c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3386c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); 3387c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3388358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/** 3389ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \brief Retrieve a range for a piece that forms the cursors spelling name. 3390ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * Most of the times there is only one range for the complete spelling but for 33916bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * Objective-C methods and Objective-C message expressions, there are multiple 33926bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * pieces for each selector identifier. 3393ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 3394ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param pieceIndex the index of the spelling name piece. If this is greater 3395ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * than the actual number of pieces, it will return a NULL (invalid) range. 3396ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 3397ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param options Reserved. 3398ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis */ 3399ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios KyrtzidisCINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, 3400ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned pieceIndex, 3401ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned options); 3402ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis 3403ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis/** 3404358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor. 3405358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * 3406358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor, 3407358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a 3408358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization. 3409358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */ 3410358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); 3411358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor 3412c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the 3413c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references. 3414c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * 3415c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an 3416c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class. 34171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the 3418c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or 3419c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged. 34201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor. 3421c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */ 3422c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); 3423b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 34241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 3425b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief For a cursor that is either a reference to or a declaration 3426b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * of some entity, retrieve a cursor that describes the definition of 3427b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that entity. 3428b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3429b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * Some entities can be declared multiple times within a translation 3430b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * unit, but only one of those declarations can also be a 3431b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * definition. For example, given: 3432b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3433b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \code 3434b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 3435b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int g(int x, int y) { return f(x, y); } 3436b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int a, int b) { return a + b; } 3437b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 3438b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \endcode 3439b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3440b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * there are three declarations of the function "f", but only the 3441b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * second one is a definition. The clang_getCursorDefinition() 3442b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * function will take any cursor pointing to a declaration of "f" 3443b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * (the first or fourth lines of the example) or a cursor referenced 3444b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that uses "f" (the call to "f' inside "g") and will return a 3445b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration cursor pointing to the definition (the second "f" 3446b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration). 3447b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3448b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * If given a cursor for which there is no corresponding definition, 3449b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * e.g., because there is no definition of that entity within this 3450b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * translation unit, returns a NULL cursor. 3451b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 3452b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); 3453b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 34541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 3455b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor 3456b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity. 3457b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 3458b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); 3459b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 3460c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 34611a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor. 34621a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 34631a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several 34641a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can 34651a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined: 34661a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 34671a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code 34681a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 34691a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 34701a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X { 34711a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * int member; 34721a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * }; 34731a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode 34741a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 34751a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three 34761a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying 34771a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which 34781a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can 34791a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by 34801a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors. 34811a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 34821a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor. 34831a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */ 34841a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); 34851a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor 348634ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis 348734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis/** 34886bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief If the cursor points to a selector identifier in an Objective-C 34896bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * method or message expression, this returns the selector index. 349034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * 34917eee0184570366285589d788bcd7f5dda8345915James Dennett * After getting a cursor with #clang_getCursor, this can be called to 349234ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * determine if the location points to a selector identifier. 349334ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * 34946bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \returns The selector index if the cursor is an Objective-C method or message 349534ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * expression and the cursor is pointing to a selector identifier, or -1 349634ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * otherwise. 349734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis */ 349834ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); 349934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis 35001a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/** 35016bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Given a cursor pointing to a C++ method call or an Objective-C 35026bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * message, returns non-zero if the method/message is "dynamic", meaning: 3503f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * 3504f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For a C++ method: the call is virtual. 35056bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * For an Objective-C message: the receiver is an object instance, not 'super' 35066bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * or a specific class. 3507f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * 3508f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * If the method/message is "static" or the cursor does not point to a 3509f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * method/message, it will return zero. 3510f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis */ 3511f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); 3512e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis 3513e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis/** 35146bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Given a cursor pointing to an Objective-C message, returns the CXType 35156bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * of the receiver. 3516e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis */ 3517e4a990f34904eb572c8d6aa1deef19465214359cArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); 3518f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis 3519f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis/** 35209ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \brief Property attributes for a \c CXCursor_ObjCPropertyDecl. 35219ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis */ 35229ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidistypedef enum { 35239ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_noattr = 0x00, 35249ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_readonly = 0x01, 35259ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_getter = 0x02, 35269ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_assign = 0x04, 35279ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_readwrite = 0x08, 35289ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_retain = 0x10, 35299ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_copy = 0x20, 35309ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_nonatomic = 0x40, 35319ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_setter = 0x80, 35329ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_atomic = 0x100, 35339ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_weak = 0x200, 35349ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_strong = 0x400, 35359ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis CXObjCPropertyAttr_unsafe_unretained = 0x800 35369ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis} CXObjCPropertyAttrKind; 35379ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis 35389ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis/** 35399ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \brief Given a cursor that represents a property declaration, return the 35409ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * associated property attributes. The bits are formed from 35419ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \c CXObjCPropertyAttrKind. 35429ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * 35439ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis * \param reserved Reserved for future use, pass 0. 35449ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis */ 35459ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_getObjCPropertyAttributes(CXCursor C, 35469ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis unsigned reserved); 35479ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis 35489ee6a66d19aacc35397bbdc4fd535e3944301856Argyrios Kyrtzidis/** 354938dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis * \brief 'Qualifiers' written next to the return and parameter types in 35506bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * Objective-C method declarations. 355138dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis */ 355238dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidistypedef enum { 355338dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_None = 0x0, 355438dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_In = 0x1, 355538dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_Inout = 0x2, 355638dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_Out = 0x4, 355738dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_Bycopy = 0x8, 355838dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_Byref = 0x10, 355938dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis CXObjCDeclQualifier_Oneway = 0x20 356038dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis} CXObjCDeclQualifierKind; 356138dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis 356238dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis/** 35636bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Given a cursor that represents an Objective-C method or parameter 35646bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * declaration, return the associated Objective-C qualifiers for the return 35656bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * type or the parameter respectively. The bits are formed from 35666bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * CXObjCDeclQualifierKind. 356738dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis */ 356838dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_getObjCDeclQualifiers(CXCursor C); 356938dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis 357038dbad233bfc7906e38e028707ffe5925b9ca46cArgyrios Kyrtzidis/** 35716bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Given a cursor that represents an Objective-C method or property 35726bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * declaration, return non-zero if the declaration was affected by "@optional". 3573514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis * Returns zero if the cursor is not such a declaration or it is "@required". 3574514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis */ 3575514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isObjCOptional(CXCursor C); 3576514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis 3577514afc7255a2aaa88498b3374c944a2c497c1c55Argyrios Kyrtzidis/** 357880e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis * \brief Returns non-zero if the given cursor is a variadic function or method. 357980e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis */ 358080e1acaeb7040548cb494e609b120b134e22a193Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Cursor_isVariadic(CXCursor C); 358180e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis 358280e1acaeb7040548cb494e609b120b134e22a193Argyrios Kyrtzidis/** 3583aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated 3584aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment's source range. The range may include multiple consecutive comments 3585aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * with whitespace in between. 3586aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */ 3587aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); 3588aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko 3589aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/** 3590aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated 3591aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment text, including comment markers. 3592aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */ 3593aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); 3594aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko 3595aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/** 3596ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g., 3597ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated \\brief paragraph; otherwise return the 3598ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * first paragraph. 35992d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko */ 36002d44d77fed3200e2eff289f55493317e90d3398cDmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); 36012d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko 36022d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko/** 3603ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @} 3604ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3605ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3606ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 36075d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \defgroup CINDEX_MODULE Module introspection 36085d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36095d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * The functions in this group provide access to information about modules. 36105d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36115d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @{ 36125d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 36135d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36145d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidistypedef void *CXModule; 36155d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36165d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 36175d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module. 36185d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 36195d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); 36205d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36215d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 36226bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Given a CXFile header file, return the module that contains it, if one 36236bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * exists. 36246bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines */ 36256bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen HinesCINDEX_LINKAGE CXModule clang_getModuleForFile(CXTranslationUnit, CXFile); 36266bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines 36276bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines/** 3628d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 36295d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 3630e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis * \returns the module file where the provided module object came from. 3631e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis */ 3632e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios KyrtzidisCINDEX_LINKAGE CXFile clang_Module_getASTFile(CXModule Module); 3633e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis 3634e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis/** 3635e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis * \param Module a module object. 3636e858e667c14ce4a9df5a4bbae770a0a3a3c8723eArgyrios Kyrtzidis * 36375d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the parent of a sub-module or NULL if the given module is top-level, 36385d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * e.g. for 'std.vector' it will return the 'std' module. 36395d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3640d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); 36415d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36425d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3643d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 36445d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36455d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the name of the module, e.g. for the 'std.vector' sub-module it 36465d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * will return "vector". 36475d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3648d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); 36495d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36505d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3651d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 36525d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36535d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the full name of the module, e.g. "std.vector". 36545d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3655d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); 36565d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36575d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3658d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 36595d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36606bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \returns non-zero if the module is a system one. 36616bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines */ 36626bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen HinesCINDEX_LINKAGE int clang_Module_isSystem(CXModule Module); 36636bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines 36646bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines/** 36656bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \param Module a module object. 36666bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * 36675d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the number of top level headers associated with this module. 36685d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3669c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXTranslationUnit, 3670c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis CXModule Module); 36715d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36725d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3673d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 36745d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36755d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \param Index top level header index (zero-based). 36765d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 36775d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the specified top level header associated with the module. 36785d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3679d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE 3680c1d22393628a145e54396c0ac66e9625d13a7658Argyrios KyrtzidisCXFile clang_Module_getTopLevelHeader(CXTranslationUnit, 3681c1d22393628a145e54396c0ac66e9625d13a7658Argyrios Kyrtzidis CXModule Module, unsigned Index); 36825d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36835d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 36845d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @} 36855d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 36865d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 36875d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 36889ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection 36899ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 36909ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific 36919ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features. 36929ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 36939ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{ 36949ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 36959ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 36969ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 3697c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko * \brief Determine if a C++ member function or member function template is 3698c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko * pure virtual. 3699c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko */ 3700c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri GribenkoCINDEX_LINKAGE unsigned clang_CXXMethod_isPureVirtual(CXCursor C); 3701c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko 3702c965f76e02d536d875b1e9e3ea96f39452c6bfa2Dmitri Gribenko/** 370349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is 370449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'. 37059ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 37069ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); 37079ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 37089ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 3709211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is 3710211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from 3711211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes. 3712211924b563aa31421836cee7655be729ad02733fDouglas Gregor */ 3713211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); 3714211924b563aa31421836cee7655be729ad02733fDouglas Gregor 3715211924b563aa31421836cee7655be729ad02733fDouglas Gregor/** 37166bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Determine if a C++ member function or member function template is 37176bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * declared 'const'. 37186bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines */ 37196bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen HinesCINDEX_LINKAGE unsigned clang_CXXMethod_isConst(CXCursor C); 37206bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines 37216bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines/** 372249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine 372349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating 372449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template. 372549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 372649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template, 372749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the 372849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is 372949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union". 373049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 373149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template 373249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration. 373349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 373449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated 373549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns 373649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound. 373749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */ 373849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); 373949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor 374049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/** 3741e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation 3742e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it 3743e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated. 3744e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3745e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit 3746e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template, 3747e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template 3748e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return 3749e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was 3750e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template 3751e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a 3752e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this 3753e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template. 3754e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3755e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or 3756e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member. 3757e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class 3758e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that 3759e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly. 3760e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3761e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member 3762e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template. 3763e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3764e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a 3765e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or 3766e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor. 3767e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */ 3768e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); 3769430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3770430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/** 3771430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range 3772430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference. 3773430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3774430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or 3775430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call. 3776430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags: 3777430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and 3778430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece. 3779430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag 3780430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is 3781430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a 378248d798ce32447607144db70a484cdb99c1180663Benjamin Kramer * non-contiguous names, this index can be used to retrieve the individual 3783430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece. 3784430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3785430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no 3786430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. 3787430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 378848a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, 378948a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet unsigned NameFlags, 3790430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor unsigned PieceIndex); 3791430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3792430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags { 3793430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3794430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the 3795430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * range. 3796430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3797430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantQualifier = 0x1, 3798430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3799430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 38007eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Include the explicit template arguments, e.g. \<int> in x.f<int>, 38017eee0184570366285589d788bcd7f5dda8345915James Dennett * in the range. 3802430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3803430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantTemplateArgs = 0x2, 3804430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3805430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3806430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief If the name is non-contiguous, return the full spanning range. 3807430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3808430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * Non-contiguous names occur in Objective-C when a selector with two or more 3809430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * parameters is used, or in C++ when using an operator: 3810430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \code 38116bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * [object doSomething:here withValue:there]; // Objective-C 3812430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * return some_vector[1]; // C++ 3813430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \endcode 3814430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3815430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantSinglePiece = 0x4 3816430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor}; 3817e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor 3818e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/** 38199ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @} 38209ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 38219ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 38229ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 38230045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation 38240045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 38250045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a 38260045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to 38270045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors. 3828fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3829fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{ 3830fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3831fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3832fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3833fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token. 3834fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3835fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind { 3836fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3837fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A token that contains some kind of punctuation. 3838fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3839fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Punctuation, 3840896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3841fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 38420045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \brief A language keyword. 3843fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3844fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Keyword, 3845896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3846fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3847fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief An identifier (that is not a keyword). 3848fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3849fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Identifier, 3850896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3851fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3852fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A numeric, string, or character literal. 3853fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3854fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Literal, 3855896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3856fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3857fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A comment. 3858fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3859fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Comment 3860fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind; 3861fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3862fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3863fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token. 3864fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3865fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct { 3866fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor unsigned int_data[4]; 3867fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor void *ptr_data; 3868fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken; 3869fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3870fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3871fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token. 3872fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3873fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); 3874896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3875fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3876fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token. 3877fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3878fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g., 3879fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword. 3880fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3881fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); 3882896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3883fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3884fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token. 3885fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3886896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, 3887fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken); 3888896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3889fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3890fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token. 3891fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3892fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); 3893fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3894fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3895fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw 3896fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens. 3897fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3898fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized. 3899fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3900fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the 3901fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range, 3902fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3903fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens 3904fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be 3905fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed. 3906fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3907fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens 3908fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array. 3909fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3910fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3911fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, 3912fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken **Tokens, unsigned *NumTokens); 3913896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3914fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3915fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token 3916fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree. 3917fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 39180045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking 39190045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the 39200045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those 39210045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are 39220045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x), 39230045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors: 39240045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 39250045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. 39260045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. 39270045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. 39280045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 39290045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the 39300045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function 39310045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small 39320045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is 39330045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation. 3934fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3935fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens. 3936fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3937fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate. 3938fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3939fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens. 3940fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3941fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be 3942fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token. 3943fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3944fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, 3945fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens, 3946fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXCursor *Cursors); 3947896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3948fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3949fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens. 3950fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3951896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, 3952fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens); 3953896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3954fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3955fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @} 3956fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3957896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3958fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3959c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities 3960c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3961c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not 3962c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon. 3963c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3964c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3965c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 39661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 39674ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */ 3968e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); 39691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, 39701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar const char **startBuf, 39714ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff const char **endBuf, 39724ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startLine, 39734ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startColumn, 39744ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endLine, 39754ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endColumn); 39760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void); 3977995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, 3978995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar unsigned stack_size); 3979995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar 39800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 3981c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3982c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 39831efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3984c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3985c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion 3986c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3987c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with 3988c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting 3989c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to 3990c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and 3991c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion. 3992c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3993c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3994c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 39951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3996c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 39970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result. 39980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 39990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion 40000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the 40010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected. 40020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which 40030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g., 40040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of 40050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace 40060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a 40071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks. 40080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString; 40101efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 40110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 40120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion. 40130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct { 40150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 40161efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief The kind of entity that this completion refers to. 40170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor kind will be a macro, keyword, or a declaration (one of the 40190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * *Decl cursor kinds), describing the entity that the completion is 40200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to. 40210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \todo In the future, we would like to provide a full cursor, to allow 40230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the client to extract additional information from declaration. 40240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor enum CXCursorKind CursorKind; 40261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 40271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 40280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief The code-completion string that describes how to insert this 40290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion result into the editing buffer. 40300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionString CompletionString; 40320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult; 40330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 40340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 40350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string. 40360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40371efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is 40381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text 40390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string. 40400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind { 40420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 40430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A code-completion string that describes "optional" text that 40440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * could be a part of the template (but is not required). 40450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The Optional chunk is the only kind of chunk that has a code-completion 40471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * string for its representation, which is accessible via 40480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \c clang_getCompletionChunkCompletionString(). The code-completion string 40490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * describes an additional part of the template that is completely optional. 40500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * For example, optional chunks can be used to describe the placeholders for 40510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * arguments that match up with defaulted function parameters, e.g. given: 40520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 40540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * void f(int x, float y = 3.14, double z = 2.71828); 40550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 40560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The code-completion string for this function would contain: 40580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a TypedText chunk for "f". 40590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a LeftParen chunk for "(". 40600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "int x" 40610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the remaining defaulted arguments, e.g., 40620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 406371570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * - a Placeholder chunk for "float y" 40640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the last defaulted argument: 40650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 40660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "double z" 40670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a RightParen chunk for ")" 40680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 406971570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * There are many ways to handle Optional chunks. Two simple approaches are: 40700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Completely ignore optional chunks, in which case the template for the 40710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would only include the first parameter ("int x"). 40720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Fully expand all optional chunks, in which case the template for the 40730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would have all of the parameters. 40740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Optional, 40760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 40770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that a user would be expected to type to get this 40781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * code-completion result. 40790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40801efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * There will be exactly one "typed text" chunk in a semantic string, which 40811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * will typically provide the spelling of a keyword or the name of a 40820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * declaration that could be used at the current code point. Clients are 40830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * expected to filter the code-completion results based on the text in this 40840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * chunk. 40850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_TypedText, 40870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 40880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that should be inserted as part of a code-completion result. 40890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "text" chunk represents text that is part of the template to be 40910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * inserted into user code should this particular code-completion result 40920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * be selected. 40930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 40940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Text, 40950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 40960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Placeholder text that should be replaced by the user. 40970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 40980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "placeholder" chunk marks a place where the user should insert text 40990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * into the code-completion template. For example, placeholders might mark 41000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the function parameters for a function declaration, to indicate that the 41010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * user should provide arguments for each of those parameters. The actual 41020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * text in a placeholder is a suggestion for the text to display before 41030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the user replaces the placeholder with real code. 41040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Placeholder, 41060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Informative text that should be displayed but never inserted as 41080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * part of the template. 41091efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 41100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * An "informative" chunk contains annotations that can be displayed to 41110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * help the user decide whether a particular code-completion result is the 41120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * right option, but which is not part of the actual template to be inserted 41130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * by code completion. 41140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Informative, 41160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that describes the current parameter when code-completion is 41180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to function call, message send, or template specialization. 41190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "current parameter" chunk occurs when code-completion is providing 41210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * information about a parameter corresponding to the argument at the 41220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion point. For example, given a function 41230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 41250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * int add(int x, int y); 41260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 41270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * and the source code \c add(, where the code-completion point is after the 41290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "(", the code-completion string will contain a "current parameter" chunk 41300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * for "int x", indicating that the current argument will initialize that 41310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * parameter. After typing further, to \c add(17, (where the code-completion 41321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * point is after the ","), the code-completion string will contain a 41330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "current paremeter" chunk to "int y". 41340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_CurrentParameter, 41360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left parenthesis ('('), used to initiate a function call or 41380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the beginning of a function parameter list. 41390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftParen, 41410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right parenthesis (')'), used to finish a function call or 41430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the end of a function parameter list. 41440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightParen, 41460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left bracket ('['). 41480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBracket, 41500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right bracket (']'). 41520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBracket, 41540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left brace ('{'). 41560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBrace, 41580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right brace ('}'). 41600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBrace, 41620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left angle bracket ('<'). 41640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftAngle, 41660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right angle bracket ('>'). 41680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightAngle, 41700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A comma separator (','). 41720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 4173ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor CXCompletionChunk_Comma, 4174ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor /** 41751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Text that specifies the result type of a given result. 4176ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * 4177ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * This special kind of informative chunk is not meant to be inserted into 41781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the text buffer. Rather, it is meant to illustrate the type that an 4179ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * expression using the given completion string would have. 4180ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor */ 418101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_ResultType, 418201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 418301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A colon (':'). 418401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 418501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Colon, 418601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 418701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A semicolon (';'). 418801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 418901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_SemiColon, 419001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 419101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief An '=' sign. 419201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 419301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Equal, 419401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 419501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Horizontal space (' '). 419601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 419701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_HorizontalSpace, 419801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 419901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Vertical space ('\n'), after which it is generally a good idea to 420001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * perform indentation. 420101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 420201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_VerticalSpace 42030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor}; 42041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 42050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 42060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string. 42070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 42090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 42110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number. 42130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42141efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind 42150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string, 42160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 42171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 42180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 42191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a 42200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string. 42210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 42230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 42250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number. 42270c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42282ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString 42290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string, 42300c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 42310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 42320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 42331efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk 42340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string. 42350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 42370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 42390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index 42416164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number. 42420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString 42440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string, 42450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 42461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 42470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 42480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string. 42490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned 42510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string); 42520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 42530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 425412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion. 425512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 425612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this 425712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The 425812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics. 425912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 426012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query. 426112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 426212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate 426312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions. 426412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */ 426512e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned 426612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string); 426712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor 426812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/** 426958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion 427058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to. 427158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 427258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query. 427358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 427458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string. 427558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 427658ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 427758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string); 427858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 427958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 42806164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given 42816164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 42826164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 42836164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 42846164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 42856164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion 42866164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string. 42876164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 42886164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned 42896164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string); 42906164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 42916164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 42926164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string. 42936164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 42946164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 42956164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 42966164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the 42976164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 42986164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 42996164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index 43006164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available. 43016164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 43026164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString 43036164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string, 43046164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen unsigned annotation_number); 43056164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 43066164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 4307ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \brief Retrieve the parent context of the given completion string. 4308ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4309ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * The parent context of a completion string is the semantic parent of 4310ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the declaration (if any) that the code completion represents. For example, 4311ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * a code completion for an Objective-C method would have the method's class 4312ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or protocol as its context. 4313ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4314ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param completion_string The code completion string whose parent is 4315ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * being queried. 4316ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4317526d24444c91404dc4165b141e5ec095125c1bc8Argyrios Kyrtzidis * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. 4318ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 43197eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns The name of the completion parent, e.g., "NSObject" if 4320ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the completion string represents a method in the NSObject class. 4321ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor */ 4322ba1030698dbc276db86b11c5329a1edee8a1805eDouglas GregorCINDEX_LINKAGE CXString 4323ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregorclang_getCompletionParent(CXCompletionString completion_string, 4324ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor enum CXCursorKind *kind); 4325d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4326d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko/** 4327d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Retrieve the brief documentation comment attached to the declaration 4328d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * that corresponds to the given completion string. 4329d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 4330d99ef536b241071b6f4c01db6525dc03242ac30bDmitri GribenkoCINDEX_LINKAGE CXString 4331d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenkoclang_getCompletionBriefComment(CXCompletionString completion_string); 4332d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4333ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor/** 43348fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro 43358fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor. 43368fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 43378fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query. 43388fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 43398fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro 43408fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors. 43418fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */ 43428fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString 43438fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor); 43448fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor 43458fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/** 4346ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion. 4347ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * 4348ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as 4349e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by 4350ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults. 4351ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4352ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct { 4353ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 4354ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The code-completion results. 4355ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4356ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor CXCompletionResult *Results; 4357ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 4358ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 4359ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The number of code-completion results stored in the 4360ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c Results array. 4361ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4362ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor unsigned NumResults; 4363ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults; 4364ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 4365ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/** 4366cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to 4367cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior. 4368cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 4369cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to 4370cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt(). 4371cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4372cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags { 4373cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 4374cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include macros within the set of code 4375cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completions returned. 4376cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4377cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor CXCodeComplete_IncludeMacros = 0x01, 4378cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4379cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 4380cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include code patterns for language constructs 4381cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * within the set of code completions, e.g., for loops. 4382cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4383d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXCodeComplete_IncludeCodePatterns = 0x02, 4384d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4385d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko /** 4386d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Whether to include brief documentation within the set of code 4387d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * completions returned. 4388d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 4389d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXCodeComplete_IncludeBriefComments = 0x04 4390cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor}; 4391cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4392cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 43933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring. 43943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 43953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple 43963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously. 43973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 43983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext { 43993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The context for completions is unexposed, as only Clang results 44013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included. (This is equivalent to having no context bits set.) 44023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unexposed = 0, 44043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible type should be included in the results. 44073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyType = 1 << 0, 44093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible value (variables, function calls, etc.) 44123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 44133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyValue = 1 << 1, 44153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C object should 44173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * be included in the results. 44183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCObjectValue = 1 << 2, 44203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C selector 44223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 44233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorValue = 1 << 3, 44253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to a C++ class type should be 44273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 44283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_CXXClassTypeValue = 1 << 4, 44303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the dot 44333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 44343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_DotMemberAccess = 1 << 5, 44363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the arrow 44383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 44393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ArrowMemberAccess = 1 << 6, 44413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for properties of the Objective-C object being accessed 44433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * using the dot operator should be included in the results. 44443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCPropertyAccess = 1 << 7, 44463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for enum tags should be included in the results. 44493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_EnumTag = 1 << 8, 44513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for union tags should be included in the results. 44533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_UnionTag = 1 << 9, 44553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for struct tags should be included in the results. 44573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_StructTag = 1 << 10, 44593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ class names should be included in the results. 44623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ClassTag = 1 << 11, 44643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ namespaces and namespace aliases should be 44663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 44673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Namespace = 1 << 12, 44693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ nested name specifiers should be included in 44713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 44723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NestedNameSpecifier = 1 << 13, 44743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 44753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C interfaces (classes) should be included 44773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 44783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInterface = 1 << 14, 44803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C protocols should be included in 44823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 44833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCProtocol = 1 << 15, 44853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C categories should be included in 44873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 44883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCCategory = 1 << 16, 44903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C instance messages should be included 44923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 44933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInstanceMessage = 1 << 17, 44953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 44963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C class messages should be included in 44973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 44983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 44993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCClassMessage = 1 << 18, 45003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C selector names should be included in 45023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 45033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorName = 1 << 19, 45053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for preprocessor macro names should be included in 45083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 45093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_MacroName = 1 << 20, 45113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Natural language completions should be included in the results. 45143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NaturalLanguage = 1 << 21, 45163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The current context is unknown, so set all contexts. 45193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unknown = ((1 << 22) - 1) 45213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor}; 45223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 4524cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be 4525cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt(). 4526cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4527cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); 4528cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4529cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 45301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit. 45311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and 45331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential 45341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model 45351abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file, 45361abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has 45371abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed 45381abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the 45391abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of 45401abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are 45411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure. 45421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the 45441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the 45451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p 45461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then 45471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">", 45481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that 45491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the 45501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results 45511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for 45521abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after 45531abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 45541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only 45551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface 45561abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion 45571abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must 45581abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency. 45591abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45601abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should 45611abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be 45621abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may 45631abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the 45641abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation. 45651abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45661abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code 45671abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file 45681abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit. 45691abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45701abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur. 45711abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45721abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur. 45731abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that 45741abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token. 45751abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45761abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk 45771abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the 45781abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files. The contents and name of these files (as 45791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the 45801abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to 45811abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns. 45821abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 45831abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 45841abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files. 45851abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 4586cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code 4587cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the 4588cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The 4589cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set 4590cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options. 4591cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 45921abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure 45931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be 45941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code 45951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL. 45961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */ 45971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE 45981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, 45991abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor const char *complete_filename, 46001abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_line, 46011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_column, 46021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor struct CXUnsavedFile *unsaved_files, 4603cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned num_unsaved_files, 4604cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned options); 46051abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor 46061abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/** 46071e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical 46081e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order. 46091e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * 46101e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort. 46111e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results. 46121e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */ 46131e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE 46141e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results, 46151e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor unsigned NumResults); 46161e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor 46171e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/** 4618ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results. 46190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 46201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE 4621ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); 462258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 462320d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/** 4624a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the 4625a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed. 4626a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 4627896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 4628a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); 4629a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 4630a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 4631a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion. 4632a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 46337eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Results the code completion results to query. 4634a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 4635a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 4636a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 4637a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 4638a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 4639896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 4640a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, 4641a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 4642a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 4643a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 46446bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief Determines what completions are appropriate for the context 46453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion. 46463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 46473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query 46483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 46493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use 46503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results. 46513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE 46533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts( 46543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCodeCompleteResults *Results); 4655e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 4656e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 4657e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code 4658e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for 4659e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C 4660e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return 4661e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode. 4662e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4663e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 4664e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4665e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete 4666e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete 4667e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true. 4668e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4669e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a 4670e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container 4671e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 4672e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 4673e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind( 4674e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor CXCodeCompleteResults *Results, 4675e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor unsigned *IsIncomplete); 4676e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 4677e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 4678e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion 4679e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this 4680e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string. 4681e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4682e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 4683e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4684e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container 4685e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 4686e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 4687e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); 46883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46890a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 46900a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/** 46910a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message 46920a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a 46930a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and 46940a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage. 46950a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 46960a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query 46970a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 46980a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far 46990a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send. 47000a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */ 47010a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE 47020a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); 47030a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 47043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 470520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @} 470620d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */ 47071efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 47081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 470904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/** 471004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions 471104bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * 471204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{ 471304bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 471423e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek 471523e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/** 471623e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not 471723e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * intended to be parsed (the format is not guaranteed to be stable). 471823e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */ 4719f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXString clang_getClangVersion(void); 472004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek 4721d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 4722d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/** 4723d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery. 4724d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * 47257eee0184570366285589d788bcd7f5dda8345915James Dennett * \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero 47267eee0184570366285589d788bcd7f5dda8345915James Dennett * value enables crash recovery, while 0 disables it. 4727d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */ 4728d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); 4729d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 473016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /** 4731896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Visitor invoked for each file in a translation unit 473216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * (used with clang_getInclusions()). 473316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * 473416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * This visitor function will be invoked by clang_getInclusions() for each 47357eee0184570366285589d788bcd7f5dda8345915James Dennett * file included (either at the top-level or by \#include directives) within 473616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * a translation unit. The first argument is the file being included, and 473716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the second and third arguments provide the inclusion stack. The 473816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * array is sorted in order of immediate inclusion. For example, 473916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the first element refers to the location that included 'included_file'. 474016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 474116b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file, 474216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXSourceLocation* inclusion_stack, 474316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek unsigned include_len, 474416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 474516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 474616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 474716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit. 474816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * The visitor function is called with the provided data for every included 474916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * file. This does not include headers included by the PCH file (unless one 475016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * is inspecting the inclusions in the PCH file itself). 475116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 475216b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, 475316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXInclusionVisitor visitor, 475416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 475516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 475616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 475704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @} 475804bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 47591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 476097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions 476197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 476297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{ 476397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 476497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 476597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 476697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files. 476797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 476897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping; 476997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 477097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 477197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping. 477297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 477397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings. 477497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 477597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed 477697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 477797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 477897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); 477997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 478097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 478130660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \brief Retrieve a remapping. 478230660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 478330660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param filePaths pointer to an array of file paths containing remapping info. 478430660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 478530660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param numFiles number of file paths. 478630660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 478730660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \returns the requested remapping. This remapping must be freed 478830660a898545416f0fea2d717f16f75640001e38Ted Kremenek * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 478930660a898545416f0fea2d717f16f75640001e38Ted Kremenek */ 479030660a898545416f0fea2d717f16f75640001e38Ted KremenekCINDEX_LINKAGE 479130660a898545416f0fea2d717f16f75640001e38Ted KremenekCXRemapping clang_getRemappingsFromFileList(const char **filePaths, 479230660a898545416f0fea2d717f16f75640001e38Ted Kremenek unsigned numFiles); 479330660a898545416f0fea2d717f16f75640001e38Ted Kremenek 479430660a898545416f0fea2d717f16f75640001e38Ted Kremenek/** 479597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings. 479697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 479797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); 479897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 479997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 480097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping. 480197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 480297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename. 480397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 480497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original 480597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with. 480697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 480797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, 480897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis CXString *original, CXString *transformed); 480997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 481097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 481197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping. 481297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 481397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping); 481497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 481597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 481697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @} 481797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 481897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 4819aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions 4820aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4821aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{ 4822aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4823aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4824aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult { 4825aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Break, 4826aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Continue 4827aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis}; 4828aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4829aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct { 4830aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis void *context; 4831aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); 4832aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor; 4833aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 48346f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidistypedef enum { 48356f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis /** 48366f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \brief Function returned successfully. 48376f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis */ 48386f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXResult_Success = 0, 48396f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis /** 48406f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \brief One of the parameters was invalid for the function. 48416f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis */ 48426f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXResult_Invalid = 1, 48436f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis /** 48446f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \brief The function was terminated by a callback (e.g. it returned 48456f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * CXVisit_Break) 48466f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis */ 48476f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXResult_VisitBreak = 2 48486f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis 48496f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis} CXResult; 48506f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis 4851aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 4852aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file. 4853aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4854aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one. 4855aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4856aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references. 4857aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4858aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 4859aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found. 4860aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside 4861aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid. 4862389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis * 48636f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators. 4864aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 48656f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findReferencesInFile(CXCursor cursor, CXFile file, 48666f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXCursorAndRangeVisitor visitor); 4867aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4868ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis/** 4869ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \brief Find #import/#include directives in a specific file. 4870ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * 4871ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param TU translation unit containing the file to query. 4872ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * 4873ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param file to search for #import/#include directives. 4874ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * 4875ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 4876ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis * each directive found. 4877389dc5603fa10b508a38f668a7830c6d877b6542Argyrios Kyrtzidis * 48786f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis * \returns one of the CXResult enumerators. 4879ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis */ 48806f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCINDEX_LINKAGE CXResult clang_findIncludesInFile(CXTranslationUnit TU, 48816f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXFile file, 48826f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXCursorAndRangeVisitor visitor); 4883ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis 4884aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature 4885aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# if __has_feature(blocks) 4886aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4887aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult 4888aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); 4889aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4890aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE 48916f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findReferencesInFileWithBlock(CXCursor, CXFile, 48926f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXCursorAndRangeVisitorBlock); 4893aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4894ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios KyrtzidisCINDEX_LINKAGE 48956f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios KyrtzidisCXResult clang_findIncludesInFileWithBlock(CXTranslationUnit, CXFile, 48966f09c3d69f6272b101ff795562dffead1c0bd9deArgyrios Kyrtzidis CXCursorAndRangeVisitorBlock); 4897ee2d5fd7a3bd42bce387db094d27a479617c3e67Argyrios Kyrtzidis 4898aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# endif 4899aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif 4900aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4901bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4902bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile. 4903bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4904dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile; 4905bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 4906bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 49072957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity. 49082957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 49092957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity; 49102957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 49112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 4912bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container 4913bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities. 4914bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4915dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer; 4916bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 4917bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4918bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH 4919bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module). 4920bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4921dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile; 49224e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4923bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 4924dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks. 4925bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 49264e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 49274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void *ptr_data[2]; 49284e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned int_data; 49294e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc; 49304e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4931bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 49327eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for ppIncludedFile callback. 4933bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 49344e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 4935bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 49367eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Location of '#' in the \#include/\#import directive. 4937bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 49384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc hashLoc; 4939bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 49407eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Filename as written in the \#include/\#import directive. 4941bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 49424e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *filename; 4943bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 49447eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief The actual file that the \#include/\#import directive resolved to. 4945bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4946dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXFile file; 49474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isImport; 49484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isAngled; 49498d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis /** 49508d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis * \brief Non-zero if the directive was automatically turned into a module 49518d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis * import. 49528d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis */ 49538d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis int isModuleImport; 49544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo; 49554e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4956bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 49577eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#importedASTFile. 4958bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 49594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 49602c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis /** 49612c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * \brief Top level AST file containing the imported PCH, module or submodule. 49622c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis */ 49634e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile file; 4964bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4965134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * \brief The imported module or NULL if the AST file is a PCH. 4966bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4967134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis CXModule module; 4968bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 4969134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * \brief Location where the file is imported. Applicable only for modules. 4970bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 4971134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis CXIdxLoc loc; 49722c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis /** 49732c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * \brief Non-zero if an inclusion directive was automatically turned into 4974134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * a module import. Applicable only for modules. 49752c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis */ 497637f2f52fbc16b0d426d4d86c7e1662e5c6b9e3b8Argyrios Kyrtzidis int isImplicit; 49772c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis 49784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo; 49794e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4980dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 4981dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Unexposed = 0, 4982dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Typedef = 1, 4983dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Function = 2, 4984dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Variable = 3, 4985dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Field = 4, 4986dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_EnumConstant = 5, 49874e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4988dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCClass = 6, 4989dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCProtocol = 7, 4990dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCCategory = 8, 49914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4992c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCInstanceMethod = 9, 4993c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCClassMethod = 10, 4994c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCProperty = 11, 4995c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCIvar = 12, 49964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 4997c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Enum = 13, 4998c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Struct = 14, 4999c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Union = 15, 50002957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 50012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXClass = 16, 50022957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespace = 17, 50032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespaceAlias = 18, 50042957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticVariable = 19, 50052957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticMethod = 20, 50062957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXInstanceMethod = 21, 500717d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXConstructor = 22, 500817d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXDestructor = 23, 500917d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXConversionFunction = 24, 501017d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXTypeAlias = 25, 501117d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXInterface = 26 501217d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos 501317d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos} CXIdxEntityKind; 501417d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos 5015838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum { 5016838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_None = 0, 5017838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_C = 1, 5018838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_ObjC = 2, 5019838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_CXX = 3 5020838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage; 5021838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis 50222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 50232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to: 50242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function 50252957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass 50262957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod 50272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod 50282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor 50292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction 50302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias 50312957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 50322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum { 50332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_NonTemplate = 0, 50342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_Template = 1, 50352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplatePartialSpecialization = 2, 50362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplateSpecialization = 3 50372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind; 50382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 5039b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum { 5040b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_Unexposed = 0, 5041b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBAction = 1, 5042b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutlet = 2, 5043b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutletCollection = 3 5044b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind; 5045b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5046b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 5047b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttrKind kind; 5048b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor cursor; 5049b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc loc; 5050b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo; 5051b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5052b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 5053643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityKind kind; 5054643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityCXXTemplateKind templateKind; 5055643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityLanguage lang; 5056643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *name; 5057643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *USR; 5058643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 5059643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 5060643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis unsigned numAttributes; 5061643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo; 5062643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 5063643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 5064643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 5065643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo; 5066643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 5067643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 5068b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *attrInfo; 5069b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 5070b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor classCursor; 5071b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc classLoc; 5072b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo; 5073b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5074838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidistypedef enum { 5075838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIdxDeclFlag_Skipped = 0x1 5076838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis} CXIdxDeclInfoFlags; 5077838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 50784e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 50796ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *entityInfo; 5080dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXCursor cursor; 5081dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxLoc loc; 5082b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *semanticContainer; 5083b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis /** 50847eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Generally same as #semanticContainer but can be different in 5085b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis * cases like out-of-line C++ member functions. 5086b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis */ 5087b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *lexicalContainer; 5088dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis int isRedeclaration; 50894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isDefinition; 5090c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isContainer; 50912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *declAsContainer; 5092c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis /** 5093c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis * \brief Whether the declaration exists in code or was created implicitly 50946bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * by the compiler, e.g. implicit Objective-C methods for properties. 5095c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis */ 5096c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isImplicit; 5097b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 5098b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis unsigned numAttributes; 5099838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5100838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis unsigned flags; 5101838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5102dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo; 51034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5104dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 5105dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_ForwardRef = 0, 5106dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Interface = 1, 5107dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Implementation = 2 5108dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind; 51094e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51104e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 51116ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 5112dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainerKind kind; 5113dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo; 51144e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51154e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 51166ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *base; 51176ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 51184e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 51196ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo; 51204e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51214e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 51226ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *protocol; 51236ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 51244e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 51254e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo; 51264e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51274e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 51286ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxObjCProtocolRefInfo *const *protocols; 51294e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned numProtocols; 5130c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo; 51314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51324e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5133c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 5134c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxBaseClassInfo *superInfo; 5135c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 5136c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo; 51374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 51382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct { 5139c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 5140c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 5141c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXCursor classCursor; 5142c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXIdxLoc classLoc; 5143c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 5144c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo; 5145c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis 5146c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct { 51472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 5148792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *getter; 5149792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *setter; 5150792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis} CXIdxObjCPropertyDeclInfo; 5151792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 5152792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidistypedef struct { 5153792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 51542957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxBaseClassInfo *const *bases; 51552957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned numBases; 51562957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo; 51572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 5158bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 51597eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference. 5160bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5161aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum { 5162bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5163bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity is referenced directly in user's code. 5164bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5165aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis CXIdxEntityRef_Direct = 1, 5166bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 51676bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * \brief An implicit reference, e.g. a reference of an Objective-C method 51686bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * via the dot syntax. 5169bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5170b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxEntityRef_Implicit = 2 5171aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind; 5172aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis 5173bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 51747eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference. 5175bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 51764e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5177b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis CXIdxEntityRefKind kind; 5178bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5179bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Reference cursor. 5180bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 51814e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXCursor cursor; 51824e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 5183bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5184bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity that gets referenced. 5185bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 51866ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *referencedEntity; 5187bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5188bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Immediate "parent" of the reference. For example: 5189bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5190bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \code 5191bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * Foo *var; 5192bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \endcode 5193bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5194bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * The parent of reference of type 'Foo' is the variable 'var'. 5195e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * For references inside statement bodies of functions/methods, 5196e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * the parentEntity will be the function/method. 5197bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 51986ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *parentEntity; 5199bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5200e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * \brief Lexical container context of the reference. 5201bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52022957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *container; 52034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo; 52044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52057eee0184570366285589d788bcd7f5dda8345915James Dennett/** 52067eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief A group of callbacks used by #clang_indexSourceFile and 52077eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_indexTranslationUnit. 52087eee0184570366285589d788bcd7f5dda8345915James Dennett */ 52094e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5210bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 52116ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * \brief Called periodically to check whether indexing should be aborted. 52126ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * Should return 0 to continue, and non-zero to abort. 52136ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis */ 52146ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis int (*abortQuery)(CXClientData client_data, void *reserved); 52156ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 52166ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis /** 5217b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * \brief Called at the end of indexing; passes the complete diagnostic set. 5218bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52194e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*diagnostic)(CXClientData client_data, 5220b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXDiagnosticSet, void *reserved); 52214e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5222dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*enteredMainFile)(CXClientData client_data, 52237eee0184570366285589d788bcd7f5dda8345915James Dennett CXFile mainFile, void *reserved); 5224dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5225bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 52267eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Called when a file gets \#included/\#imported. 5227bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5228dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, 52296ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxIncludedFileInfo *); 52304e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5231bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5232bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called when a AST file (PCH or module) gets imported. 5233bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5234bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * AST files will not get indexed (there will not be callbacks to index all 5235bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the entities in an AST file). The recommended action is that, if the AST 52362c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * file is not already indexed, to initiate a new indexing job specific to 52372c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * the AST file. 5238bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5239dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, 52406ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxImportedASTFileInfo *); 52414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5242bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5243bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called at the beginning of indexing a translation unit. 5244bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5245dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, 52466ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void *reserved); 52474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52486ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void (*indexDeclaration)(CXClientData client_data, 52492957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *); 52504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5251bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5252bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called to index a reference of an entity. 5253bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52544e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*indexEntityReference)(CXClientData client_data, 52556ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityRefInfo *); 52564e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks; 52584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5259ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); 52606ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * 52616ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); 52626ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 52636ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * 52646ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); 5265dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5266ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE 52676ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo * 52686ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); 52696ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 5270c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * 5271c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); 5272dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5273792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * 5274792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidisclang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); 5275792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 5276b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * 5277b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); 5278b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 52792957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo * 52802957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); 52812957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 52822957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 52832957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a 52842957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 52852957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 52862957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer 52872957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *); 52882957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 52892957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 52902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a 52912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 52922957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 52932957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 52942957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); 52952957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 52962957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 52972957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity. 52982957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 52992957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity 53002957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *); 53012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53022957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 53032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity. 53042957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 53052957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 53062957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); 53072957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53082957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 5309838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple 5310838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units. 53112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 53122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction; 53132957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53142957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 5315838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple 5316838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units. 53172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 53182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated. 53192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 53202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); 53212957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 53232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action. 53242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 53252957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units 53262957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed. 53272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 53282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); 53292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 533021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum { 533121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 533221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Used to indicate that no special indexing options are needed. 533321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 533421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXIndexOpt_None = 0x0, 533521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 533621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 53377eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Used to indicate that IndexerCallbacks#indexEntityReference should 53387eee0184570366285589d788bcd7f5dda8345915James Dennett * be invoked for only one reference of an entity per source file that does 53397eee0184570366285589d788bcd7f5dda8345915James Dennett * not also include a declaration/definition of the entity. 534021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 534122490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis CXIndexOpt_SuppressRedundantRefs = 0x1, 534222490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis 534322490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis /** 534422490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * \brief Function-local symbols should be indexed. If this is not set 534522490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * function-local symbols will be ignored. 534622490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis */ 534758d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis CXIndexOpt_IndexFunctionLocalSymbols = 0x2, 534858d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis 534958d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis /** 535058d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * \brief Implicit function/class template instantiations should be indexed. 535158d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * If this is not set, implicit instantiations will be ignored. 535258d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis */ 5353b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, 5354b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis 5355b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis /** 5356b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis * \brief Suppress all compiler warnings when parsing for indexing. 5357b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis */ 5358838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIndexOpt_SuppressWarnings = 0x8, 5359838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5360838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis /** 5361838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief Skip a function/method body that was already parsed during an 53626bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines * indexing session associated with a \c CXIndexAction object. 5363838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * Bodies in system headers are always skipped. 5364838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis */ 5365838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIndexOpt_SkipParsedBodiesInSession = 0x10 5366838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 536721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags; 536821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 5369bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5370bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding 53717eee0184570366285589d788bcd7f5dda8345915James Dennett * to that file via callbacks implemented through #IndexerCallbacks. 5372bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5373bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will 5374bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks. 5375bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5376bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client 5377bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements. 5378bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 53797eee0184570366285589d788bcd7f5dda8345915James Dennett * \param index_callbacks_size Size of #IndexerCallbacks structure that gets 5380bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks. 5381bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 538221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is 538321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. 5384bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5385651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \param[out] out_TU pointer to store a \c CXTranslationUnit that can be 5386651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * reused after indexing is finished. Set to \c NULL if you do not require it. 5387bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5388651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * \returns 0 on success or if there were errors from which the compiler could 5389651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * recover. If there is a failure from which the there is no recovery, returns 5390651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines * a non-zero \c CXErrorCode. 539121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 53927eee0184570366285589d788bcd7f5dda8345915James Dennett * The rest of the parameters are the same as #clang_parseTranslationUnit. 5393bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 53942957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, 53954e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXClientData client_data, 53964e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis IndexerCallbacks *index_callbacks, 53974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_callbacks_size, 53984e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_options, 53994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *source_filename, 54004e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char * const *command_line_args, 54014e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int num_command_line_args, 54024e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis struct CXUnsavedFile *unsaved_files, 54034e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned num_unsaved_files, 54044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXTranslationUnit *out_TU, 54054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned TU_options); 54064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5407bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 540821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through 54097eee0184570366285589d788bcd7f5dda8345915James Dennett * #IndexerCallbacks. 541021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 541121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as 541221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be: 541321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 541421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Preprocessor callbacks invocations 541521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Declaration/reference callbacks invocations 541621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Diagnostic callback invocations 541721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 54187eee0184570366285589d788bcd7f5dda8345915James Dennett * The parameters are the same as #clang_indexSourceFile. 541921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 542021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns 542121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0. 542221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 54232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, 542421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXClientData client_data, 542521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis IndexerCallbacks *index_callbacks, 542621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis unsigned index_callbacks_size, 54272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned index_options, 54282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXTranslationUnit); 542921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 543021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/** 5431bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by 5432bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc. 5433bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5434bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the 5435bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument 5436bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument. 5437bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 54384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, 5439dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile *indexFile, 54404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile *file, 54414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *line, 54424e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *column, 54434e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *offset); 54444e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5445bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5446bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc. 5447bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 54484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE 54494e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); 54504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5451aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 5452aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @} 5453aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 5454aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5455c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 5456c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 5457c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 54581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 54596bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines/* Include the comment API for compatibility. This will eventually go away. */ 54606bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines#include "clang-c/Documentation.h" 54616bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines 5462d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus 5463d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek} 5464d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 5465d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 5466d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 5467