Index.h revision 67812b2f94f4b5e7d2596db1705ffa1149ddc45a
1d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek/*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ 2d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* *| 3d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* The LLVM Compiler Infrastructure *| 4d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* *| 5d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* This file is distributed under the University of Illinois Open Source *| 6d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* License. See LICENSE.TXT for details. *| 7d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* *| 8d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|*===----------------------------------------------------------------------===*| 9d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* *| 10d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* This header provides a public inferface to a Clang library for extracting *| 11d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* high-level symbol information from source files without exposing the full *| 12d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* Clang C++ API. *| 13d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek|* *| 14d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek\*===----------------------------------------------------------------------===*/ 15d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 16d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifndef CLANG_C_INDEX_H 17d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#define CLANG_C_INDEX_H 18d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 1988145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff#include <sys/stat.h> 203d31560343856c573376a04558a7111e7afad4f7Chandler Carruth#include <time.h> 210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor#include <stdio.h> 2288145034694ed5267fa6fa5febc54fadc02bd479Steve Naroff 23db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/Platform.h" 24db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison#include "clang-c/CXString.h" 25db2a685287e57d9dfec09c867152c465af6fc6b0Arnaud A. de Grandmaison 264d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis/** 274d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * \brief The version constants for the libclang API. 284d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MINOR should increase when there are API additions. 294d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * CINDEX_VERSION_MAJOR is intended for "major" source/ABI breaking changes. 304d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * 314d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * The policy about the libclang API was always to keep it source and ABI 324d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. 334d9eff53c49a2c1b9b460b899c95dcdbb3e056e1Argyrios Kyrtzidis */ 34ca9805a79dad01f12fa13c245f48724203699f08Argyrios Kyrtzidis#define CINDEX_VERSION_MAJOR 0 352d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis#define CINDEX_VERSION_MINOR 10 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/** 300dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * \brief Determine whether the given header is guarded against 301dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor * multiple inclusions, either with the conventional 3027eee0184570366285589d788bcd7f5dda8345915James Dennett * \#ifndef/\#define/\#endif macro guards or with \#pragma once. 303dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor */ 304dd3e5549e3c11e217078938aacf72f042eea5343Douglas GregorCINDEX_LINKAGE unsigned 305dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregorclang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file); 306dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor 307dd3e5549e3c11e217078938aacf72f042eea5343Douglas Gregor/** 308b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a file handle within the given translation unit. 309b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 310b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param tu the translation unit 3111efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 312b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \param file_name the name of the file. 313b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 314b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns the file handle for the named file in the translation unit \p tu, 315b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * or a NULL file handle if the file was not a part of this translation unit. 316b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 3171efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu, 318b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor const char *file_name); 3191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 320b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 321f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 322f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 323f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor 324f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 325f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * \defgroup CINDEX_LOCATIONS Physical source locations 326f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 327f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * Clang represents physical source locations in its abstract syntax tree in 328f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * great detail, with file, line, and column information for the majority of 329f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * the tokens parsed in the source code. These data types and functions are 330f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * used to represent source location information, either for a particular 331f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * point in the program or for a range of points in the program, and extract 332f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * specific location information from those data types. 333f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * 334f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @{ 335f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 3361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 337f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 3381db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * \brief Identifies a specific source location within a translation 3391db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * unit. 3401db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 34120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * Use clang_getExpansionLocation() or clang_getSpellingLocation() 342a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * to map a source location to a particular file, line, and column. 3433c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3443c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 3455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor void *ptr_data[2]; 3461db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned int_data; 3473c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceLocation; 348fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3493c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor/** 350d52864bd33c66aacc84133460d8c9c0dfcdd5c18Daniel Dunbar * \brief Identifies a half-open character range in the source code. 3513c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor * 3521db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the 3531db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * starting and end locations from a source range, respectively. 3543c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor */ 3553c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregortypedef struct { 3565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor void *ptr_data[2]; 3571db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned begin_int_data; 3581db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned end_int_data; 3593c7313d96cd4a18cd8c1fcd3ddd8128c2fcbe58fDouglas Gregor} CXSourceRange; 360fe6fd3d41a7f48317d6856c9327b6cead32c3498Ted Kremenek 3611db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 362b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a NULL (invalid) source location. 363b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 364f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceLocation clang_getNullLocation(void); 3651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 366b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3677eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two source locations, which must refer into 3681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the same translation unit, refer to exactly the same point in the source 369b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * code. 370b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 371b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns non-zero if the source locations refer to the same location, zero 372b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * if they refer to different locations. 373b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 374b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1, 375b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation loc2); 3761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 377b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3781efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieves the source location associated with a given file/line/column 3791efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * in a particular translation unit. 380b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 381b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu, 382b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXFile file, 383b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned line, 384b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor unsigned column); 38583889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall/** 38683889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * \brief Retrieves the source location associated with a given character offset 38783889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall * in a particular translation unit. 38883889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall */ 38983889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid ChisnallCINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu, 39083889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall CXFile file, 39183889a7f1f338e343ef72aeeef9c27f7b62c0f0fDavid Chisnall unsigned offset); 3921efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 393b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 3945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve a NULL (invalid) source range. 3955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 396f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXSourceRange clang_getNullRange(void); 397896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 399b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Retrieve a source range given the beginning and ending source 400b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * locations. 401b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor */ 402b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, 403b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor CXSourceLocation end); 4041efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 405b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor/** 406ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \brief Determine whether two ranges are equivalent. 407ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * 408ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor * \returns non-zero if the ranges are the same, zero if they differ. 409ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor */ 410ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas GregorCINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, 411ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor CXSourceRange range2); 412ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor 413ab4e83b904d81d8ab1f8c594655822a023cad87dDouglas Gregor/** 4141824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p range is null. 415de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis */ 416733dbc805facad7cebec5420f6c47c83848cee5fErik VerbruggenCINDEX_LINKAGE int clang_Range_isNull(CXSourceRange range); 417de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis 418de5db649fd5f9aedde200f443ad73d62517b1c88Argyrios Kyrtzidis/** 41946766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \brief Retrieve the file, line, column, and offset represented by 42046766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * the given source location. 4211db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 42220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * If the location refers into a macro expansion, retrieves the 42320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * location of the macro expansion. 424a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 4251efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param location the location within a source file that will be decomposed 4261efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * into its parts. 4271db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4281efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param file [out] if non-NULL, will be set to the file to which the given 4291db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4301db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4311efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param line [out] if non-NULL, will be set to the line to which the given 4321db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * source location points. 4331db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor * 4341efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \param column [out] if non-NULL, will be set to the column to which the given 4351efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source location points. 43646766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * 43746766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 43846766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor * buffer to which the given source location points. 4391db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 44020174221af145554b76a0b0f5e4eb3ac70d05945Chandler CarruthCINDEX_LINKAGE void clang_getExpansionLocation(CXSourceLocation location, 44120174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth CXFile *file, 44220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *line, 44320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *column, 44420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth unsigned *offset); 44520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth 44620174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth/** 447e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by 448e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the given source location, as specified in a # line directive. 449e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 450e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * Example: given the following source code in a file somefile.c 451e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 4527eee0184570366285589d788bcd7f5dda8345915James Dennett * \code 453e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * #123 "dummy.c" 1 454e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 455e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * static int func(void) 456e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * { 457e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * return 0; 458e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * } 4597eee0184570366285589d788bcd7f5dda8345915James Dennett * \endcode 460e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 461e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * the location information returned by this function would be 462e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 463e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: dummy.c Line: 124 Column: 12 464e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 465e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * whereas clang_getExpansionLocation would have returned 466e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 467e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * File: somefile.c Line: 3 Column: 12 468e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 469e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed 470e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * into its parts. 471e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 472e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param filename [out] if non-NULL, will be set to the filename of the 473e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. Note that filenames returned will be for "virtual" files, 474e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * which don't necessarily exist on the machine running clang - e.g. when 475e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * parsing preprocessed output obtained from a different environment. If 476e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * a non-NULL value is passed in, remember to dispose of the returned value 477e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * using \c clang_disposeString() once you've finished with it. For an invalid 478e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location, an empty string is returned. 479e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 480e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line number of the 481e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 482e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * 483e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column number of the 484e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis * source location. For an invalid source location, zero is returned. 485e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis */ 486e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios KyrtzidisCINDEX_LINKAGE void clang_getPresumedLocation(CXSourceLocation location, 487e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis CXString *filename, 488e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *line, 489e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis unsigned *column); 490e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis 491e6be34d8f77312edf9ed38034e52cb4d22c8e1c1Argyrios Kyrtzidis/** 49220174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * \brief Legacy API to retrieve the file, line, column, and offset represented 49320174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * by the given source location. 49420174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * 49520174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * This interface has been replaced by the newer interface 4967eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_getExpansionLocation(). See that interface's documentation for 49720174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth * details. 49820174221af145554b76a0b0f5e4eb3ac70d05945Chandler Carruth */ 4991db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location, 5001db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor CXFile *file, 5011db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor unsigned *line, 50246766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *column, 50346766dc31c09d89024de5aba9e22112a56eadbdfDouglas Gregor unsigned *offset); 504e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor 505e69517ce61638f12c9abe4605753a45275ac4e37Douglas Gregor/** 506a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \brief Retrieve the file, line, column, and offset represented by 507a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * the given source location. 508a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 509a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * If the location refers into a macro instantiation, return where the 510a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * location was originally spelled in the source file. 511a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 512a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param location the location within a source file that will be decomposed 513a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * into its parts. 514a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 515a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param file [out] if non-NULL, will be set to the file to which the given 516a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 517a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 518a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param line [out] if non-NULL, will be set to the line to which the given 519a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 520a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 521a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param column [out] if non-NULL, will be set to the column to which the given 522a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * source location points. 523a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * 524a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * \param offset [out] if non-NULL, will be set to the offset into the 525a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor * buffer to which the given source location points. 526a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor */ 527a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas GregorCINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location, 528a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor CXFile *file, 529a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *line, 530a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *column, 531a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor unsigned *offset); 5322d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis 5332d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis/** 5342d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \brief Retrieve the file, line, column, and offset represented by 5352d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * the given source location. 5362d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5372d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * If the location refers into a macro expansion, return where the macro was 5382d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * expanded or where the macro argument was written, if the location points at 5392d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * a macro argument. 5402d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5412d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param location the location within a source file that will be decomposed 5422d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * into its parts. 5432d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5442d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param file [out] if non-NULL, will be set to the file to which the given 5452d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5462d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5472d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param line [out] if non-NULL, will be set to the line to which the given 5482d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5492d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5502d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param column [out] if non-NULL, will be set to the column to which the given 5512d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * source location points. 5522d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * 5532d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * \param offset [out] if non-NULL, will be set to the offset into the 5542d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis * buffer to which the given source location points. 5552d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis */ 5562d5c133d3dd95507db63147997109f06e8cfa833Argyrios KyrtzidisCINDEX_LINKAGE void clang_getFileLocation(CXSourceLocation location, 5572d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis CXFile *file, 5582d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *line, 5592d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *column, 5602d5c133d3dd95507db63147997109f06e8cfa833Argyrios Kyrtzidis unsigned *offset); 561a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor 562a9b06d4c246d6c301e3dd1844f5dba669ed9c631Douglas Gregor/** 5631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the first character within a 5641efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 5651db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 5661db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range); 5671db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 5681db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor/** 5691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve a source location representing the last character within a 5701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * source range. 5711db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor */ 5721db19dea8d221f27be46332d668d1e2decb7f1abDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range); 5731db19dea8d221f27be46332d668d1e2decb7f1abDouglas Gregor 574f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor/** 575f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor * @} 576f55254472e496340cbb4f0a24cff398e441475b5Douglas Gregor */ 577c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 578c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 5795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_DIAG Diagnostic reporting 5805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 5815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 5825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 5845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 5855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Describes the severity of a particular diagnostic. 5865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5875352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorenum CXDiagnosticSeverity { 5885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 589896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief A diagnostic that has been suppressed, e.g., by a command-line 5905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * option. 5915352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5925352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Ignored = 0, 593896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 5945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 5955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic is a note that should be attached to the 5965352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * previous (non-note) diagnostic. 5975352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 5985352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Note = 1, 5995352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6005352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6015352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates suspicious code that may not be 6025352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * wrong. 6035352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6045352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Warning = 2, 6055352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed. 6085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Error = 3, 6105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor /** 6125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief This diagnostic indicates that the code is ill-formed such 6135352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * that future parser recovery is unlikely to produce useful 6145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * results. 6155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXDiagnostic_Fatal = 4 6175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor}; 6185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 6205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief A single diagnostic, containing the diagnostic's severity, 6215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * location, text, source ranges, and fix-it hints. 6225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 6235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregortypedef void *CXDiagnostic; 6245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 6255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 626153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief A group of CXDiagnostics. 627153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 628153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenektypedef void *CXDiagnosticSet; 629153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 630153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 631153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Determine the number of diagnostics in a CXDiagnosticSet. 632153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 633153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags); 634153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 635153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 636153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Retrieve a diagnostic associated with the given CXDiagnosticSet. 637153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 6387eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Diags the CXDiagnosticSet to query. 639153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \param Index the zero-based diagnostic number to retrieve. 640153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 641153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns the requested diagnostic. This diagnostic must be freed 642153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * via a call to \c clang_disposeDiagnostic(). 643153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 644153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags, 645153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek unsigned Index); 646153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 647153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 648153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 649153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Describes the kind of error that occurred (if any) in a call to 650153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \c clang_loadDiagnostics. 651153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 652153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenekenum CXLoadDiag_Error { 653153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 654153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that no error occurred. 655153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 656153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_None = 0, 657153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 658153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 659153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that an unknown error occurred while attempting to 660153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserialize diagnostics. 661153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 662153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_Unknown = 1, 663153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 664153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 665153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the file containing the serialized diagnostics 666153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * could not be opened. 667153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 668153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_CannotLoad = 2, 669153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 670153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek /** 671153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Indicates that the serialized diagnostics file is invalid or 6727eee0184570366285589d788bcd7f5dda8345915James Dennett * corrupt. 673153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 674153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXLoadDiag_InvalidFile = 3 675153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek}; 676153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 677153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 678153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Deserialize a set of diagnostics from a Clang diagnostics bitcode 6797eee0184570366285589d788bcd7f5dda8345915James Dennett * file. 680153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 6817eee0184570366285589d788bcd7f5dda8345915James Dennett * \param file The name of the file to deserialize. 6827eee0184570366285589d788bcd7f5dda8345915James Dennett * \param error A pointer to a enum value recording if there was a problem 683153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * deserializing the diagnostics. 6847eee0184570366285589d788bcd7f5dda8345915James Dennett * \param errorString A pointer to a CXString for recording the error string 685153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * if the file was not successfully loaded. 686153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * 687153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise. These 6887eee0184570366285589d788bcd7f5dda8345915James Dennett * diagnostics should be released using clang_disposeDiagnosticSet(). 689153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 690153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(const char *file, 691153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek enum CXLoadDiag_Error *error, 692153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek CXString *errorString); 693153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 694153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 695153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek * \brief Release a CXDiagnosticSet and all of its contained diagnostics. 696153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 697153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags); 698153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 699153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 7007eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the child diagnostics of a CXDiagnostic. 7017eee0184570366285589d788bcd7f5dda8345915James Dennett * 7027eee0184570366285589d788bcd7f5dda8345915James Dennett * This CXDiagnosticSet does not need to be released by 7037eee0184570366285589d788bcd7f5dda8345915James Dennett * clang_diposeDiagnosticSet. 704153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek */ 705153221717e39ce41323d5bc6b8b8bf130923c1bdTed KremenekCINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D); 706153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek 707153221717e39ce41323d5bc6b8b8bf130923c1bdTed Kremenek/** 708a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced for the given 709a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * translation unit. 710a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 711a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit); 712a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 713a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 714a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given translation unit. 7155352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 716a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Unit the translation unit to query. 717a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 7185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 719a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 720a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 7215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 722a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit, 723a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 724a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 725a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 7260373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \brief Retrieve the complete set of diagnostics associated with a 7270373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * translation unit. 7280373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * 7290373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek * \param Unit the translation unit to query. 7300373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek */ 7310373fcc3e5b205cc26656c70d7dff737b0e08345Ted KremenekCINDEX_LINKAGE CXDiagnosticSet 7320373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek clang_getDiagnosticSetFromTU(CXTranslationUnit Unit); 7330373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek 7340373fcc3e5b205cc26656c70d7dff737b0e08345Ted Kremenek/** 735a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Destroy a diagnostic. 736a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 737a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic); 7385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 7395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 7400a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Options to control the display of diagnostics. 7410a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7420a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * The values in this enum are meant to be combined to customize the 7430a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * behavior of \c clang_displayDiagnostic(). 7440a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7450a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregorenum CXDiagnosticDisplayOptions { 7460a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 7470a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Display the source-location information where the 7480a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic was located. 7490a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7500a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * When set, diagnostics will be prefixed by the file, line, and 7510a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * (optionally) column to which the diagnostic refers. For example, 7520a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7530a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \code 7540a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * test.c:28: warning: extra tokens at end of #endif directive 7550a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \endcode 7560a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7570a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-source-location. 7580a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7590a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplaySourceLocation = 0x01, 7600a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7610a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 7620a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 7630a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include the column number. 7640a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 7650a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * This option corresponds to the clang flag \c -fshow-column. 7660a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 7670a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor CXDiagnostic_DisplayColumn = 0x02, 7680a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 7690a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor /** 7700a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief If displaying the source-location information of the 7710a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * diagnostic, also include information about source ranges in a 7720a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * machine-parsable format. 7730a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 774896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * This option corresponds to the clang flag 7750a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \c -fdiagnostics-print-source-range-info. 7760a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 777aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplaySourceRanges = 0x04, 778aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 779aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 780aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the option name associated with this diagnostic, if any. 781aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 782aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The option name displayed (e.g., -Wconversion) will be placed in brackets 783aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * after the diagnostic text. This option corresponds to the clang flag 784aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-option. 785aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 786aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayOption = 0x08, 787aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 788aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 789aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category number associated with this diagnostic, if any. 790aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 791aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category number is displayed within brackets after the diagnostic text. 792aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 793aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=id. 794aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 795aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryId = 0x10, 796aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 797aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor /** 798aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Display the category name associated with this diagnostic, if any. 799aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 800aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * The category name is displayed within brackets after the diagnostic text. 801aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * This option corresponds to the clang flag 802aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c -fdiagnostics-show-category=name. 803aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 804aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXDiagnostic_DisplayCategoryName = 0x20 8050a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor}; 8060a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8070a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 808274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \brief Format the given diagnostic in a manner that is suitable for display. 8090a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 810274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * This routine will format the given diagnostic to a string, rendering 811896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the diagnostic according to the various options given. The 812896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \c clang_defaultDiagnosticDisplayOptions() function returns the set of 8130a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * options that most closely mimics the behavior of the clang compiler. 8140a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8150a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \param Diagnostic The diagnostic to print. 8160a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 817896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Options A set of options that control the diagnostic display, 8180a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * created by combining \c CXDiagnosticDisplayOptions values. 819274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * 820274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor * \returns A new string containing for formatted diagnostic. 8210a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 822274f1906f12ebf8fcc179701deeda6d3271120c1Douglas GregorCINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic, 823274f1906f12ebf8fcc179701deeda6d3271120c1Douglas Gregor unsigned Options); 8240a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 8260a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \brief Retrieve the set of display options most similar to the 8270a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * default behavior of the clang compiler. 8280a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * 8290a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * \returns A set of display options suitable for use with \c 8300a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor * clang_displayDiagnostic(). 8310a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor */ 8320a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void); 8330a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor 8340a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas Gregor/** 8355352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the severity of the given diagnostic. 8365352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 837896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE enum CXDiagnosticSeverity 8385352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getDiagnosticSeverity(CXDiagnostic); 8395352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 8415352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the source location of the given diagnostic. 8425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 8435352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * This location is where Clang would print the caret ('^') when 8445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * displaying the diagnostic on the command line. 8455352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 8465352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic); 8475352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 8485352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 8495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Retrieve the text of the given diagnostic. 8505352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 8515352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic); 852a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor 853a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor/** 854aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the name of the command-line option that enabled this 855aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic. 856aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 857aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Diag The diagnostic to be queried. 858aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 859aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Disable If non-NULL, will be set to the option that disables this 860aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostic (if any). 861aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 862aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns A string that contains the command-line option used to enable this 863aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * warning, such as "-Wconversion" or "-pedantic". 864aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 865aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag, 866aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor CXString *Disable); 867aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 868aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 869aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \brief Retrieve the category number for this diagnostic. 870aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 871aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * Diagnostics can be categorized into groups along with other, related 872aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * diagnostics (e.g., diagnostics under the same warning flag). This routine 873aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * retrieves the category number for the given diagnostic. 874aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 875aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The number of the category that contains this diagnostic, or zero 876aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * if this diagnostic is uncategorized. 877aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 878aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic); 879aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 880aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 88178d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the name of a particular diagnostic category. This 88278d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * is now deprecated. Use clang_getDiagnosticCategoryText() 88378d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * instead. 884aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 885aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \param Category A diagnostic category number, as returned by 886aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \c clang_getDiagnosticCategory(). 887aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * 888aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor * \returns The name of the given diagnostic category. 889aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor */ 89078d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_DEPRECATED CINDEX_LINKAGE 89178d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCXString clang_getDiagnosticCategoryName(unsigned Category); 89278d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek 89378d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek/** 89478d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \brief Retrieve the diagnostic category text for a given diagnostic. 89578d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * 89678d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek * \returns The text of the given diagnostic category. 89778d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted Kremenek */ 89878d5d3bb9386a5aa31d19445eb8f81bf2652acb4Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic); 899aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor 900aa5f135f8db82b5e5fb1640fd51f8078e0b2d82dDouglas Gregor/** 901a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Determine the number of source ranges associated with the given 902a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * diagnostic. 903a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor */ 904a3890baf1256ff26081306c7fef70202f8223f41Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic); 905896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 9065352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 907a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \brief Retrieve a source range associated with the diagnostic. 9085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 909a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * A diagnostic's source ranges highlight important elements in the source 9105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * code. On the command line, Clang displays source ranges by 911896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * underlining them with '~' characters. 9125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 913a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \param Diagnostic the diagnostic whose range is being extracted. 9145352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 915896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \param Range the zero-based index specifying which range to 9165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 917a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor * \returns the requested source range. 9185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 919896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic, 920a3890baf1256ff26081306c7fef70202f8223f41Douglas Gregor unsigned Range); 9215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9235352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Determine the number of fix-it hints associated with the 9245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * given diagnostic. 9255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic); 9275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9285352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 929473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \brief Retrieve the replacement information for a given fix-it. 9305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 931473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * Fix-its are described in terms of a source range whose contents 932473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * should be replaced by a string. This approach generalizes over 933473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * three kinds of operations: removal of source code (the range covers 934473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * the code to be removed and the replacement string is empty), 935473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replacement of source code (the range covers the code to be 936473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced and the replacement string provides the new code), and 937473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion (both the start and end of the range point at the 938473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insertion location, and the replacement string provides the text to 939473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * insert). 9405352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 941473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param Diagnostic The diagnostic whose fix-its are being queried. 9425352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 943473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param FixIt The zero-based index of the fix-it. 9445352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 945473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \param ReplacementRange The source range whose contents will be 946473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced with the returned replacement string. Note that source 947473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * ranges are half-open ranges [a, b), so the source code should be 948473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * replaced from a and up to (but not including) b. 9495352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 950473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * \returns A string containing text that should be replace the source 951473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor * code indicated by the \c ReplacementRange. 9525352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 953896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic, 954473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor unsigned FixIt, 955473d7019bb54f8a2f0140dca9e9644a935cc6b20Douglas Gregor CXSourceRange *ReplacementRange); 9565352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9575352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9585352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 9595352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9605352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9615352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9625352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation 9635352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9645352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * The routines in this group provide the ability to create and destroy 9655352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * translation units from files, either by parsing the contents of the files or 9665352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * by reading in a serialized representation of a translation unit. 9675352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9685352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @{ 9695352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 970896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 9715352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9725352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Get the original translation unit source file name. 9735352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 9745352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXString 9755352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregorclang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); 9765352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 9775352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 9785352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Return the CXTranslationUnit for a given source file and the provided 9795352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * command line arguments one would pass to the compiler. 9805352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9815352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: The 'source_filename' argument is optional. If the caller provides a 9825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * NULL pointer, the name of the source file is expected to reside in the 9835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * specified command line arguments. 9845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9855352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * Note: When encountered in 'clang_command_line_args', the following options 9865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * are ignored: 9875352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9885352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-c' 9895352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-emit-ast' 9905352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * '-fsyntax-only' 9917eee0184570366285589d788bcd7f5dda8345915James Dennett * '-o \<output file>' (both '-o' and '\<output file>' are ignored) 9925352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9931ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param CIdx The index object with which the translation unit will be 9941ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * associated. 9955352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 9967eee0184570366285589d788bcd7f5dda8345915James Dennett * \param source_filename The name of the source file to load, or NULL if the 9971ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p clang_command_line_args. 9981ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 9991ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param num_clang_command_line_args The number of command-line arguments in 10001ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \p clang_command_line_args. 10011ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * 10021ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * \param clang_command_line_args The command-line arguments that would be 10031ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * passed to the \c clang executable if it were being invoked out-of-process. 10041ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * These command-line options will be parsed and will affect how the translation 10051ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * unit is parsed. Note that the following options are ignored: '-c', 10067eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 10075352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10085352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 10095352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * unsaved_files. 10105352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * 10115352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 10125352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * but may be required for code completion, including the contents of 1013c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * those files. The contents and name of these files (as specified by 1014c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * CXUnsavedFile) are copied when necessary, so the client only needs to 1015c6f530defd937faa1c00998e60deea6368526961Ted Kremenek * guarantee their validity until the call to this function returns. 10165352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 10175352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( 10185352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor CXIndex CIdx, 10195352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor const char *source_filename, 10205352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor int num_clang_command_line_args, 10212ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor const char * const *clang_command_line_args, 10225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor unsigned num_unsaved_files, 1023a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor struct CXUnsavedFile *unsaved_files); 1024896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 10255352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 10265352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Create a translation unit from an AST file (-emit-ast). 10275352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1028896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex, 1029a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor const char *ast_filename); 10305352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor 103144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor/** 103244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Flags that control the creation of translation units. 103344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 103444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * The enumerators in this enumeration type are meant to be bitwise 103544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * ORed together to specify which options should be used when 103644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * constructing the translation unit. 103744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 10385a43021ac491bf091494167127772a20d9a9bb48Douglas Gregorenum CXTranslationUnit_Flags { 10395a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 10405a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that no special translation-unit options are 10415a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * needed. 10425a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 10435a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor CXTranslationUnit_None = 0x0, 10445a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 10455a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor /** 10465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Used to indicate that the parser should construct a "detailed" 10475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * preprocessing record, including all macro definitions and instantiations. 10485a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 10495a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * Constructing a detailed preprocessing record requires more memory 10505a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * and time to parse, since the information contained in the record 10515a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is usually not retained. However, it can be useful for 10525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * applications that require more detailed information about the 10535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * behavior of the preprocessor. 10545a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 105544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor CXTranslationUnit_DetailedPreprocessingRecord = 0x01, 105644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 105744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 1058b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Used to indicate that the translation unit is incomplete. 105944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 1060b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * When a translation unit is considered "incomplete", semantic 1061b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * analysis that is typically performed at the end of the 1062b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * translation unit will be suppressed. For example, this suppresses 1063b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * the completion of tentative declarations in C and of 1064b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * instantiation of implicitly-instantiation function templates in 1065b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * C++. This option is typically used when parsing a header with the 1066b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * intent of producing a precompiled header. 106744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1068b1c031be513705d924038f497279b9b599868ba1Douglas Gregor CXTranslationUnit_Incomplete = 0x02, 106944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor 107044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor /** 107144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * \brief Used to indicate that the translation unit should be built with an 107244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header for the preamble. 107344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * 107444c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * An implicit precompiled header is used as an optimization when a 107544c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * particular translation unit is likely to be reparsed many times 107644c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * when the sources aren't changing that often. In this case, an 107744c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * implicit precompiled header will be built containing all of the 107844c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * initial includes at the top of the main file (what we refer to as 107944c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * the "preamble" of the file). In subsequent parses, if the 108044c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * preamble or the files in it have not changed, \c 108144c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * clang_reparseTranslationUnit() will re-use the implicit 108244c181aec37789f25f6c15543c164416f72e562aDouglas Gregor * precompiled header to improve parsing performance. 108344c181aec37789f25f6c15543c164416f72e562aDouglas Gregor */ 1084e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXTranslationUnit_PrecompiledPreamble = 0x04, 1085e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1086e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1087e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that the translation unit should cache some 1088e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion results with each reparse of the source file. 1089e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1090e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * Caching of code-completion results is a performance optimization that 1091e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * introduces some overhead to reparsing but improves the performance of 1092e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * code-completion operations. 1093e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 109499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor CXTranslationUnit_CacheCompletionResults = 0x08, 1095900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis 109699ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1097900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * \brief Used to indicate that the translation unit will be serialized with 1098900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * \c clang_saveTranslationUnit. 109999ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 1100900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * This option is typically used when parsing a header with the intent of 1101900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis * producing a precompiled header. 110299ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 1103900ab95e12bb7483971640a91075699eec391804Argyrios Kyrtzidis CXTranslationUnit_ForSerialization = 0x10, 110499ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor 110599ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor /** 1106b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * \brief DEPRECATED: Enabled chained precompiled preambles in C++. 110799ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * 110899ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor * Note: this is a *temporary* option that is available only while 1109b5af843a20e237ad1a13ad66a867e200695b8c8eDouglas Gregor * we are testing C++ precompiled preamble support. It is deprecated. 111099ba202f659e1885fa5ee114f97c97cf6a857491Douglas Gregor */ 11116a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen CXTranslationUnit_CXXChainedPCH = 0x20, 11126a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen 11136a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen /** 11146a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * \brief Used to indicate that function/method bodies should be skipped while 11156a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * parsing. 11166a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * 11176a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * This option can be used to search for declarations/definitions while 11186a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen * ignoring the usages. 11196a91d385618ea4d28236c496f540a26877c95525Erik Verbruggen */ 1120d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXTranslationUnit_SkipFunctionBodies = 0x40, 1121d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 1122d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko /** 1123d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Used to indicate that brief documentation comments should be 1124d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * included into the set of code completions returned from this translation 1125d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * unit. 1126d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 1127d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXTranslationUnit_IncludeBriefCommentsInCodeCompletion = 0x80 11285a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor}; 11295a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 11305a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor/** 1131b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * \brief Returns the set of flags that is suitable for parsing a translation 1132b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * unit that is being edited. 1133b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * 1134b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * The set of flags returned provide options for \c clang_parseTranslationUnit() 1135b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * to indicate that the translation unit is likely to be reparsed many times, 1136b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly 1137b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag 1138b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set contains an unspecified set of optimizations (e.g., the precompiled 1139b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * preamble) geared toward improving the performance of these routines. The 1140b1c031be513705d924038f497279b9b599868ba1Douglas Gregor * set of optimizations enabled may change from one version to the next. 1141b1c031be513705d924038f497279b9b599868ba1Douglas Gregor */ 1142e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void); 1143b1c031be513705d924038f497279b9b599868ba1Douglas Gregor 1144b1c031be513705d924038f497279b9b599868ba1Douglas Gregor/** 11455a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \brief Parse the given source file and the translation unit corresponding 11465a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * to that file. 11475a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11485a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * This routine is the main entry point for the Clang C API, providing the 11495a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * ability to parse a source file into a translation unit that can then be 11505a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * queried by other functions in the API. This routine accepts a set of 11515a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * command-line arguments so that the compilation can be configured in the same 11525a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * way that the compiler is configured on the command line. 11535a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11545a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param CIdx The index object with which the translation unit will be 11555a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * associated. 11565a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11575a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param source_filename The name of the source file to load, or NULL if the 11581ddb02cabd4374bcbe9afdff5123be0be8e32d12Ted Kremenek * source file is included in \p command_line_args. 11595a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11605a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param command_line_args The command-line arguments that would be 11615a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * passed to the \c clang executable if it were being invoked out-of-process. 11625a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * These command-line options will be parsed and will affect how the translation 11635a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unit is parsed. Note that the following options are ignored: '-c', 11647eee0184570366285589d788bcd7f5dda8345915James Dennett * '-emit-ast', '-fsyntax-only' (which is the default), and '-o \<output file>'. 11655a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11665a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_command_line_args The number of command-line arguments in 11675a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \p command_line_args. 11685a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11695a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param unsaved_files the files that have not yet been saved to disk 11701abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing, including the contents of 11715a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * those files. The contents and name of these files (as specified by 11725a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 11735a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * guarantee their validity until the call to this function returns. 11745a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11755a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param num_unsaved_files the number of unsaved file entries in \p 11765a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * unsaved_files. 11775a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11785a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \param options A bitmask of options that affects how the translation unit 11795a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * is managed but not its compilation. This should be a bitwise OR of the 11805a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * CXTranslationUnit_XXX flags. 11815a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * 11825a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * \returns A new translation unit describing the parsed code and containing 11835a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * any diagnostics produced by the compiler. If there is a failure from which 11845a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor * the compiler cannot recover, returns NULL. 11855a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor */ 11865a43021ac491bf091494167127772a20d9a9bb48Douglas GregorCINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx, 11875a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor const char *source_filename, 11882ef6944d529c94824f5bf96f65665f5bee30f5a2Douglas Gregor const char * const *command_line_args, 11895a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor int num_command_line_args, 11905a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor struct CXUnsavedFile *unsaved_files, 11915a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor unsigned num_unsaved_files, 11925a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor unsigned options); 11935a43021ac491bf091494167127772a20d9a9bb48Douglas Gregor 11945352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 11951999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Flags that control how translation units are saved. 11961999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 11971999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 11981999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * ORed together to specify which options should be used when 11991999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * saving the translation unit. 12001999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 12011999844e7a18786e61e619e1dc6c789827541863Douglas Gregorenum CXSaveTranslationUnit_Flags { 12021999844e7a18786e61e619e1dc6c789827541863Douglas Gregor /** 12031999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Used to indicate that no special saving options are needed. 12041999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 12051999844e7a18786e61e619e1dc6c789827541863Douglas Gregor CXSaveTranslationUnit_None = 0x0 12061999844e7a18786e61e619e1dc6c789827541863Douglas Gregor}; 12071999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 12081999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 12091999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \brief Returns the set of flags that is suitable for saving a translation 12101999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * unit. 12111999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 12121999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * The set of flags returned provide options for 12131999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \c clang_saveTranslationUnit() by default. The returned flag 12141999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * set contains an unspecified set of options that save translation units with 12151999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * the most commonly-requested data. 12161999844e7a18786e61e619e1dc6c789827541863Douglas Gregor */ 12171999844e7a18786e61e619e1dc6c789827541863Douglas GregorCINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU); 12181999844e7a18786e61e619e1dc6c789827541863Douglas Gregor 12191999844e7a18786e61e619e1dc6c789827541863Douglas Gregor/** 122039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Describes the kind of error that occurred (if any) in a call to 122139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \c clang_saveTranslationUnit(). 122239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 122339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregorenum CXSaveError { 122439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 122539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that no error occurred while saving a translation unit. 122639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 122739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_None = 0, 122839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 122939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 123039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that an unknown error occurred while attempting to save 123139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * the file. 123239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 123339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * This error typically indicates that file I/O failed when attempting to 123439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * write the file. 123539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 123639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_Unknown = 1, 123739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 123839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 123939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that errors during translation prevented this attempt 124039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * to save the translation unit. 124139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * 124239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * Errors that prevent the translation unit from being saved can be 124339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic(). 124439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 124539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_TranslationErrors = 2, 124639c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 124739c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor /** 124839c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \brief Indicates that the translation unit to be saved was somehow 124939c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * invalid (e.g., NULL). 125039c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor */ 125139c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor CXSaveError_InvalidTU = 3 125239c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor}; 125339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor 125439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor/** 12557ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \brief Saves a translation unit into a serialized representation of 12567ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * that translation unit on disk. 12577ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 12587ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * Any translation unit that was parsed without error can be saved 12597ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * into a file. The translation unit can then be deserialized into a 12607ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * new \c CXTranslationUnit with \c clang_createTranslationUnit() or, 12617ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * if it is an incomplete translation unit that corresponds to a 12627ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * header, used as a precompiled header when parsing other translation 12637ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * units. 12647ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 12657ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param TU The translation unit to save. 12661999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 12677ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * \param FileName The file to which the translation unit will be saved. 12687ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor * 12691999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * \param options A bitmask of options that affects how the translation unit 12701999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * is saved. This should be a bitwise OR of the 12711999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * CXSaveTranslationUnit_XXX flags. 12721999844e7a18786e61e619e1dc6c789827541863Douglas Gregor * 127339c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * \returns A value that will match one of the enumerators of the CXSaveError 127439c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * enumeration. Zero (CXSaveError_None) indicates that the translation unit was 127539c411fa229b2a6747b92f945d1702ee674d3470Douglas Gregor * saved successfully, while a non-zero value indicates that a problem occurred. 12767ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor */ 12777ae2faafd30524ef5f863bb3b8701977888839bbDouglas GregorCINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU, 12781999844e7a18786e61e619e1dc6c789827541863Douglas Gregor const char *FileName, 12791999844e7a18786e61e619e1dc6c789827541863Douglas Gregor unsigned options); 12807ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor 12817ae2faafd30524ef5f863bb3b8701977888839bbDouglas Gregor/** 12825352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * \brief Destroy the specified CXTranslationUnit object. 12835352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 12845352ac06d8f6194825bb2a99ffa009b61bafb503Douglas GregorCINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); 1285896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 12865352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1287e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Flags that control the reparsing of translation units. 1288e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1289e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The enumerators in this enumeration type are meant to be bitwise 1290e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * ORed together to specify which options should be used when 1291e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * reparsing the translation unit. 1292e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1293e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregorenum CXReparse_Flags { 1294e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor /** 1295e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Used to indicate that no special reparsing options are needed. 1296e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1297e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor CXReparse_None = 0x0 1298e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor}; 1299e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1300e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1301e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \brief Returns the set of flags that is suitable for reparsing a translation 1302e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * unit. 1303e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1304e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The set of flags returned provide options for 1305e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \c clang_reparseTranslationUnit() by default. The returned flag 1306e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * set contains an unspecified set of optimizations geared toward common uses 1307e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * of reparsing. The set of optimizations enabled may change from one version 1308e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * to the next. 1309e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor */ 1310e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas GregorCINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU); 1311e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor 1312e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor/** 1313abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \brief Reparse the source files that produced this translation unit. 1314abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1315abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * This routine can be used to re-parse the source files that originally 1316abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * created the given translation unit, for example because those source files 1317abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * have changed (either on disk or as passed via \p unsaved_files). The 1318abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * source code will be reparsed with the same command-line options as it 1319abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * was originally parsed. 1320abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1321abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * Reparsing a translation unit invalidates all cursors and source locations 1322abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * that refer into that translation unit. This makes reparsing a translation 1323abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit semantically equivalent to destroying the translation unit and then 1324abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * creating a new translation unit with the same command-line arguments. 1325abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * However, it may be more efficient to reparse a translation 1326abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unit using this routine. 1327abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1328abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param TU The translation unit whose contents will be re-parsed. The 1329abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * translation unit must originally have been built with 1330abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_createTranslationUnitFromSourceFile(). 1331abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1332abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 1333abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * unsaved_files. 1334abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1335abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \param unsaved_files The files that have not yet been saved to disk 1336abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * but may be required for parsing, including the contents of 1337abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * those files. The contents and name of these files (as specified by 1338abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * CXUnsavedFile) are copied when necessary, so the client only needs to 1339abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * guarantee their validity until the call to this function returns. 1340abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * 1341e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * \param options A bitset of options composed of the flags in CXReparse_Flags. 1342e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * The function \c clang_defaultReparseOptions() produces a default set of 1343e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * options recommended for most uses, based on the translation unit. 1344e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor * 1345abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \returns 0 if the sources could be reparsed. A non-zero value will be 1346abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * returned if reparsing was impossible, such that the translation unit is 1347abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * invalid. In such cases, the only valid call for \p TU is 1348abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor * \c clang_disposeTranslationUnit(TU). 1349abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor */ 1350abc563f554951259bbe0315055cad92ee14d87e4Douglas GregorCINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU, 1351abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor unsigned num_unsaved_files, 1352e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor struct CXUnsavedFile *unsaved_files, 1353e1e13bf568a7e37c95eda6fcfa626659a06e67b1Douglas Gregor unsigned options); 135459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 135559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 135659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Categorizes how memory is being used by a translation unit. 135759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1358f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekenum CXTUResourceUsageKind { 1359f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_AST = 1, 1360f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Identifiers = 2, 1361f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_Selectors = 3, 1362f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_GlobalCompletionResults = 4, 1363457aaf0692dfb2d9638f383334b81027f637f20cTed Kremenek CXTUResourceUsage_SourceManagerContentCache = 5, 1364ba29bd25515fbd99e98ba0fedb9d93617b27609eTed Kremenek CXTUResourceUsage_AST_SideTables = 6, 1365f61b831d7f6a15676b07647f507de80324cb7056Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7, 1366e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_SourceManager_Membuffer_MMap = 8, 1367e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9, 1368e9b5f3d4acfc2ad6e8b65a4072464e997dea9ed3Ted Kremenek CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10, 13695e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_Preprocessor = 11, 13705e1db6a434d0e3fe0fbde0bca2ec44552818fb22Ted Kremenek CXTUResourceUsage_PreprocessingRecord = 12, 1371ca7dc2b755eb81ac95121ce1a1f1aa44a4a0fe12Ted Kremenek CXTUResourceUsage_SourceManager_DataStructures = 13, 1372d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch = 14, 1373f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST, 1374f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_MEMORY_IN_BYTES_END = 1375d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Preprocessor_HeaderSearch, 1376f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek 1377f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsage_First = CXTUResourceUsage_AST, 1378d1194fbbf65374bfa3578eb40a547e4f97b497d1Ted Kremenek CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch 137959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek}; 138059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 138159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 138259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Returns the human-readable null-terminated C string that represents 1383f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * the name of the memory category. This string should never be freed. 138459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 138559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted KremenekCINDEX_LINKAGE 1386f787002478f09af1741fb0f82a562002e6799c49Ted Kremenekconst char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind); 138759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1388f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsageEntry { 138959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The memory usage category. */ 1390f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek enum CXTUResourceUsageKind kind; 1391f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek /* \brief Amount of resources used. 1392f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek The units will depend on the resource kind. */ 139359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned long amount; 1394f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsageEntry; 139559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 139659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 139759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief The memory usage of a CXTranslationUnit, broken into categories. 139859fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1399f787002478f09af1741fb0f82a562002e6799c49Ted Kremenektypedef struct CXTUResourceUsage { 140059fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief Private data member, used for queries. */ 140159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek void *data; 140259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 140359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief The number of entries in the 'entries' array. */ 140459fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek unsigned numEntries; 140559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 140659fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek /* \brief An array of key-value pairs, representing the breakdown of memory 140759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek usage. */ 1408f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek CXTUResourceUsageEntry *entries; 140959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1410f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek} CXTUResourceUsage; 141159fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 141259fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek/** 141359fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek * \brief Return the memory usage of a translation unit. This object 1414f787002478f09af1741fb0f82a562002e6799c49Ted Kremenek * should be released with clang_disposeCXTUResourceUsage(). 141559fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek */ 1416f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU); 141759fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1418f787002478f09af1741fb0f82a562002e6799c49Ted KremenekCINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage); 141959fc1e55da9c856d1703d3d3ac14a36320d26b30Ted Kremenek 1420abc563f554951259bbe0315055cad92ee14d87e4Douglas Gregor/** 14215352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor * @} 14225352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor */ 1423896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 14245352ac06d8f6194825bb2a99ffa009b61bafb503Douglas Gregor/** 1425c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes the kind of entity that a cursor refers to. 1426c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1427c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXCursorKind { 1428c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Declarations */ 14291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1430c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A declaration whose specific kind is not exposed via this 14311efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1432c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1433c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed declarations have the same operations as any other kind 1434c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of declaration; one can extract their location information, 1435c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, find their definitions, etc. However, the specific kind 1436c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of the declaration is not reported. 1437c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1438c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedDecl = 1, 1439c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ struct. */ 14401efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_StructDecl = 2, 1441c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C or C++ union. */ 1442c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnionDecl = 3, 1443c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A C++ class. */ 1444c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ClassDecl = 4, 1445c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumeration. */ 1446c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumDecl = 5, 14471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 1448c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A field (in C) or non-static data member (in C++) in a 1449c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * struct, union, or C++ class. 1450c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1451c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FieldDecl = 6, 1452c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An enumerator constant. */ 1453c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_EnumConstantDecl = 7, 1454c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function. */ 1455c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FunctionDecl = 8, 1456c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A variable. */ 1457c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_VarDecl = 9, 1458c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A function or method parameter. */ 1459c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ParmDecl = 10, 146017d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@interface. */ 1461c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInterfaceDecl = 11, 146217d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@interface for a category. */ 1463c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryDecl = 12, 146417d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@protocol declaration. */ 1465c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolDecl = 13, 146617d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@property declaration. */ 1467c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCPropertyDecl = 14, 1468c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance variable. */ 1469c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCIvarDecl = 15, 1470c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C instance method. */ 1471c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCInstanceMethodDecl = 16, 1472c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An Objective-C class method. */ 1473c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassMethodDecl = 17, 147417d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@implementation. */ 1475c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCImplementationDecl = 18, 147617d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@implementation for a category. */ 1477c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCCategoryImplDecl = 19, 1478c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief A typedef */ 1479c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypedefDecl = 20, 14808bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek /** \brief A C++ class method. */ 14818bd5a69999cfd06b6b5a58fdd04e4f802b2df5a4Ted Kremenek CXCursor_CXXMethod = 21, 14828f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek /** \brief A C++ namespace. */ 14838f06e0e9fec3ca501e5fb129f413adbfc88e82f8Ted Kremenek CXCursor_Namespace = 22, 1484a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek /** \brief A linkage specification, e.g. 'extern "C"'. */ 1485a0536d8dd900bb48ea886bd68d777b03b061c068Ted Kremenek CXCursor_LinkageSpec = 23, 148601829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ constructor. */ 148701829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Constructor = 24, 148801829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ destructor. */ 148901829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_Destructor = 25, 149001829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor /** \brief A C++ conversion function. */ 149101829d3afafdfd355cbe93537bc408aeeed964c6Douglas Gregor CXCursor_ConversionFunction = 26, 1492fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template type parameter. */ 1493fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTypeParameter = 27, 1494fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ non-type template parameter. */ 1495fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_NonTypeTemplateParameter = 28, 1496fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ template template parameter. */ 1497fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_TemplateTemplateParameter = 29, 1498fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor /** \brief A C++ function template. */ 1499fe72e9ceeae6cc8669cd8bb722425300190638eaDouglas Gregor CXCursor_FunctionTemplate = 30, 150039d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor /** \brief A C++ class template. */ 150139d6f07b056c31e1e6b5946165ed4b23e7887f22Douglas Gregor CXCursor_ClassTemplate = 31, 150274dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor /** \brief A C++ class template partial specialization. */ 150374dbe640021d96a8dbb85c592471c04449ade81cDouglas Gregor CXCursor_ClassTemplatePartialSpecialization = 32, 15046931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** \brief A C++ namespace alias declaration. */ 15056931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceAlias = 33, 15060a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor /** \brief A C++ using directive. */ 15070a35bceb7768fc0be62cb644a4e31d8bfd9fb44aDouglas Gregor CXCursor_UsingDirective = 34, 1508162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ using declaration. */ 15097e24256c95afb64b4d5abf201a0f9f0527cb4cf3Douglas Gregor CXCursor_UsingDeclaration = 35, 1510162e1c1b487352434552147967c3dd296ebee2f7Richard Smith /** \brief A C++ alias declaration */ 1511162e1c1b487352434552147967c3dd296ebee2f7Richard Smith CXCursor_TypeAliasDecl = 36, 15127eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@synthesize definition. */ 1513352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCSynthesizeDecl = 37, 15147eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@dynamic definition. */ 1515352697a87bca664356f21a838b162084013625eaDouglas Gregor CXCursor_ObjCDynamicDecl = 38, 15162dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis /** \brief An access specifier. */ 15172dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_CXXAccessSpecifier = 39, 151842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 151950aa6acd0b8d40c8956372a69e0a73f0802a5494Ted Kremenek CXCursor_FirstDecl = CXCursor_UnexposedDecl, 15202dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis CXCursor_LastDecl = CXCursor_CXXAccessSpecifier, 15211efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1522c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* References */ 1523c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstRef = 40, /* Decl references */ 15241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor_ObjCSuperClassRef = 40, 1525c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCProtocolRef = 41, 1526c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCClassRef = 42, 1527c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1528c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A reference to a type declaration. 1529c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1530c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A type reference occurs anywhere where a type is named but not 1531c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * declared. For example, given: 1532c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1533c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \code 1534c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * typedef unsigned size_type; 1535c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * size_type size; 1536c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \endcode 1537c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1538c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The typedef is a declaration of size_type (CXCursor_TypedefDecl), 1539c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * while the type of the variable "size" is referenced. The cursor 1540c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * referenced by the type of size is the typedef for size_type. 1541c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1542c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_TypeRef = 43, 15433064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CXCursor_CXXBaseSpecifier = 44, 15440b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor /** 1545a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * \brief A reference to a class template, function template, template 1546a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor * template parameter, or class template partial specialization. 15470b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor */ 15480b36e614aa19df72885d5e0de996f7fbb9874ec3Douglas Gregor CXCursor_TemplateRef = 45, 15496931900f43cea558c6974075256c07728dbfecc6Douglas Gregor /** 15506931900f43cea558c6974075256c07728dbfecc6Douglas Gregor * \brief A reference to a namespace or namespace alias. 15516931900f43cea558c6974075256c07728dbfecc6Douglas Gregor */ 15526931900f43cea558c6974075256c07728dbfecc6Douglas Gregor CXCursor_NamespaceRef = 46, 1553a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor /** 155436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a member of a struct, union, or class that occurs in 155536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * some non-expression context, e.g., a designated initializer. 1556a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor */ 1557a67e03fdf1ae8a1f92463a307d0b6281f1161f40Douglas Gregor CXCursor_MemberRef = 47, 155836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** 155936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \brief A reference to a labeled statement. 156036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 156136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the jump to "start_over" in the 156236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto statement in the following example: 156336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 156436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 156536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 156636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 156736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 156836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * goto start_over; 156936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 157036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 157136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * A label reference cursor refers to a label statement. 157236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 157336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelRef = 48, 157436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 15751f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor /** 15761f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief A reference to a set of overloaded functions or function templates 15771f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * that has not yet been resolved to a specific function or function template. 15781f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15791f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * An overloaded declaration reference cursor occurs in C++ templates where 15801f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * a dependent name refers to a function. For example: 15811f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15821f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \code 15831f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> void swap(T&, T&); 15841f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15851f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct X { ... }; 15861f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(X&, X&); 15871f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15881f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * template<typename T> 15891f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void reverse(T* first, T* last) { 15901f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * while (first < last - 1) { 15911f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * swap(*first, *--last); 15921f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * ++first; 15931f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 15941f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * } 15951f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 15961f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * struct Y { }; 15971f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * void swap(Y&, Y&); 15981f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \endcode 15991f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * Here, the identifier "swap" is associated with an overloaded declaration 16011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * reference. In the template definition, "swap" refers to either of the two 16021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * "swap" functions declared above, so both results will be available. At 16031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * instantiation time, "swap" may also refer to other functions found via 16041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * argument-dependent lookup (e.g., the "swap" function at the end of the 16051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * example). 16061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 16071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * The functions \c clang_getNumOverloadedDecls() and 16081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c clang_getOverloadedDecl() can be used to retrieve the definitions 16091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * referenced by this cursor. 16101f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 16111f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor CXCursor_OverloadedDeclRef = 49, 16121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 1613011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /** 1614011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \brief A reference to a variable that occurs in some non-expression 1615011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * context, e.g., a C++ lambda capture list. 1616011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1617011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_VariableRef = 50, 1618011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1619011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LastRef = CXCursor_VariableRef, 16201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1621c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Error conditions */ 1622c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstInvalid = 70, 1623c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_InvalidFile = 70, 1624c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NoDeclFound = 71, 1625c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_NotImplemented = 72, 1626ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_InvalidCode = 73, 1627ebfa339321f8a4df9d5011e591a615d5765107d5Ted Kremenek CXCursor_LastInvalid = CXCursor_InvalidCode, 16281efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1629c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Expressions */ 1630c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstExpr = 100, 16311efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1632c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1633c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression whose specific kind is not exposed via this 16341efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * interface. 1635c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1636c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed expressions have the same operations as any other kind 1637c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * of expression; one can extract their location information, 1638c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * spelling, children, etc. However, the specific kind of the 1639c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * expression is not reported. 1640c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1641c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedExpr = 100, 16421efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1643c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1644c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to some value declaration, such 1645c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * as a function, varible, or enumerator. 1646c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1647c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_DeclRefExpr = 101, 16481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1649c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1650c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief An expression that refers to a member of a struct, union, 1651c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * class, Objective-C class, etc. 1652c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1653c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_MemberRefExpr = 102, 16541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1655c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that calls a function. */ 1656c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_CallExpr = 103, 16571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1658c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** \brief An expression that sends a message to an Objective-C 1659c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor object or class. */ 1660c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_ObjCMessageExpr = 104, 16611ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 16621ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek /** \brief An expression that represents a block literal. */ 16631ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek CXCursor_BlockExpr = 105, 16641ee6cad59f017601ea54fbb4f62a6e8d69897e3eTed Kremenek 166542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An integer literal. 166642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 166742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IntegerLiteral = 106, 166842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 166942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A floating point number literal. 167042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 167142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_FloatingLiteral = 107, 167242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 167342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An imaginary number literal. 167442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 167542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ImaginaryLiteral = 108, 167642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 167742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A string literal. 167842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 167942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StringLiteral = 109, 168042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 168142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A character literal. 168242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 168342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CharacterLiteral = 110, 168442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 168542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A parenthesized expression, e.g. "(1)". 168642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 168742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This AST node is only formed if full location information is requested. 168842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 168942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ParenExpr = 111, 169042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 169142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This represents the unary-expression's (except sizeof and 169242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * alignof). 169342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 169442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryOperator = 112, 169542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 169642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.1] Array Subscripting. 169742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 169842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ArraySubscriptExpr = 113, 169942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A builtin binary operation expression such as "x + y" or 170142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "x <= y". 170242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 170342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BinaryOperator = 114, 170442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Compound assignment such as "+=". 170642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 170742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundAssignOperator = 115, 170842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 170942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The ?: ternary operator. 171042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 171142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ConditionalOperator = 116, 171242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 171342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An explicit cast in C (C99 6.5.4) or a C-style cast in C++ 171442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * (C++ [expr.cast]), which uses the syntax (Type)expr. 171542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 171642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * For example: (int)f. 171742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 171842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CStyleCastExpr = 117, 171942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 172042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C99 6.5.2.5] 172142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 172242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundLiteralExpr = 118, 172342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 172442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Describes an C or C++ initializer list. 172542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 172642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_InitListExpr = 119, 172742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 172842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The GNU address of label extension, representing &&label. 172942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_AddrLabelExpr = 120, 173142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 173242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief This is the GNU Statement Expression extension: ({int X=4; X;}) 173342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_StmtExpr = 121, 173542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1736ffbe9b9c64ab2e94b9d48ec56e511f75826fc80aBenjamin Kramer /** \brief Represents a C11 generic selection. 173742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 173842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GenericSelectionExpr = 122, 173942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 174042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Implements the GNU __null extension, which is a name for a null 174142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pointer constant that has integral type (e.g., int or long) and is the same 174242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * size and alignment as a pointer. 174342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 174442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * The __null extension is typically only used by system headers, which define 174542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NULL as __null in C++ rather than using 0 (which is an integer that may not 174642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * match the size of a pointer). 174742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 174842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GNUNullExpr = 123, 174942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 175042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s static_cast<> expression. 175142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 175242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXStaticCastExpr = 124, 175342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 175442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s dynamic_cast<> expression. 175542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 175642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDynamicCastExpr = 125, 175742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 175842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s reinterpret_cast<> expression. 175942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 176042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXReinterpretCastExpr = 126, 176142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s const_cast<> expression. 176342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 176442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXConstCastExpr = 127, 176542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 176642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an explicit C++ type conversion that uses "functional" 176742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * notion (C++ [expr.type.conv]). 176842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 176942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Example: 177042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 177142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * x = int(0.5); 177242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 177342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 177442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXFunctionalCastExpr = 128, 177542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 177642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A C++ typeid expression (C++ [expr.typeid]). 177742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 177842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTypeidExpr = 129, 177942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 178042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 2.13.5] C++ Boolean Literal. 178142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 178242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXBoolLiteralExpr = 130, 178342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 178442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++0x 2.14.7] C++ Pointer Literal. 178542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 178642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNullPtrLiteralExpr = 131, 178742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 178842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents the "this" expression in C++ 178942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 179042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThisExpr = 132, 179142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 179242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief [C++ 15] C++ Throw Expression. 179342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 179442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This handles 'throw' and 'throw' assignment-expression. When 179542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * assignment-expression isn't present, Op will be null. 179642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 179742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXThrowExpr = 133, 179842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 179942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A new expression for memory allocation and constructor calls, e.g: 180042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * "new CXXNewExpr(foo)". 180142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 180242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXNewExpr = 134, 180342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 180442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A delete expression for memory deallocation and destructor calls, 180542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * e.g. "delete[] pArray". 180642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 180742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXDeleteExpr = 135, 180842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 180942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A unary expression. 181042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_UnaryExpr = 136, 181242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 18139793e8f72a2d1f420bbbd97d41f7aaf727c26ca6Douglas Gregor /** \brief An Objective-C string literal i.e. @"foo". 181442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCStringLiteral = 137, 181642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 18177eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@encode expression. 181842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 181942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCEncodeExpr = 138, 182042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 18217eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief An Objective-C \@selector expression. 182242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 182342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCSelectorExpr = 139, 182442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 182517d26a6c1f2cb921d0000c337b4967699dc928fdJames Dennett /** \brief An Objective-C \@protocol expression. 182642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 182742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCProtocolExpr = 140, 182842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 182942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An Objective-C "bridged" cast expression, which casts between 183042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * Objective-C pointers and C pointers, transferring ownership in the process. 183142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 183242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 183342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * NSString *str = (__bridge_transfer NSString *)CFCreateString(); 183442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 183542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 183642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCBridgedCastExpr = 141, 183742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 183842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents a C++0x pack expansion that produces a sequence of 183942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 184042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 184142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * A pack expansion expression contains a pattern (which itself is an 184242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expression) followed by an ellipsis. For example: 184342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 184442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 184542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename F, typename ...Types> 184642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * void forward(F f, Types &&...args) { 184742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * f(static_cast<Types&&>(args)...); 184842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * } 184942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 185042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 185142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_PackExpansionExpr = 142, 185242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 185342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Represents an expression that computes the length of a parameter 185442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * pack. 185542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 185642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \code 185742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * template<typename ...Types> 185842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * struct count { 185942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * static const unsigned value = sizeof...(Types); 186042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * }; 186142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * \endcode 186242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 186342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SizeOfPackExpr = 143, 186442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1865011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor /* \brief Represents a C++ lambda expression that produces a local function 1866011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * object. 1867011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * 1868011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \code 1869011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * void abssort(float *x, unsigned N) { 1870011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * std::sort(x, x + N, 1871011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * [](float a, float b) { 1872011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * return std::abs(a) < std::abs(b); 1873011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * }); 1874011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * } 1875011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor * \endcode 1876011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor */ 1877011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor CXCursor_LambdaExpr = 144, 1878011d8b93b7cfa8492b8a9c909a850d6577e08dcaDouglas Gregor 1879b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek /** \brief Objective-c Boolean Literal. 1880b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek */ 1881b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek CXCursor_ObjCBoolLiteralExpr = 145, 1882b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek 1883b3f7542a950ac0d585a7783e825cfe670e05c553Ted Kremenek CXCursor_LastExpr = CXCursor_ObjCBoolLiteralExpr, 18841efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 1885c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /* Statements */ 1886c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_FirstStmt = 200, 1887c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 1888c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A statement whose specific kind is not exposed via this 1889c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * interface. 1890c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 1891c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Unexposed statements have the same operations as any other kind of 1892c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * statement; one can extract their location information, spelling, 1893c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * children, etc. However, the specific kind of the statement is not 1894c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reported. 1895c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 1896c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursor_UnexposedStmt = 200, 189736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor 189836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor /** \brief A labelled statement in a function. 189936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 190036897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * This cursor kind is used to describe the "start_over:" label statement in 190136897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * the following example: 190236897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 190336897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \code 190436897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * start_over: 190536897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * ++counter; 190636897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * \endcode 190736897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor * 190836897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor */ 190936897b05ca2886e287f01802614bc10cbadcec22Douglas Gregor CXCursor_LabelStmt = 201, 191042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A group of statements like { stmt stmt }. 191242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 191342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe compound statements, e.g. function 191442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * bodies. 191542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 191642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CompoundStmt = 202, 191742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 191842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A case statment. 191942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CaseStmt = 203, 192142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 192242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A default statement. 192342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DefaultStmt = 204, 192542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 192642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An if statement 192742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 192842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IfStmt = 205, 192942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A switch statement. 193142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 193242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SwitchStmt = 206, 193342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A while statement. 193542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 193642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_WhileStmt = 207, 193742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 193842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A do statement. 193942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DoStmt = 208, 194142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 194242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A for statement. 194342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ForStmt = 209, 194542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 194642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A goto statement. 194742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 194842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_GotoStmt = 210, 194942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 195042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief An indirect goto statement. 195142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 195242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_IndirectGotoStmt = 211, 195342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 195442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A continue statement. 195542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 195642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ContinueStmt = 212, 195742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 195842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A break statement. 195942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 196042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_BreakStmt = 213, 196142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 196242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief A return statement. 196342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 196442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ReturnStmt = 214, 196542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 1966df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier /** \brief A GCC inline assembly statement extension. 196742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 1968df5faf5e7ae6823d0af0b801c4ac26d47f2cee97Chad Rosier CXCursor_GCCAsmStmt = 215, 19695e02f6525d109c42650575c352bd2fdb14ed4193Argyrios Kyrtzidis CXCursor_AsmStmt = CXCursor_GCCAsmStmt, 197042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19717eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's overall \@try-\@catch-\@finally statement. 197242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 197342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtTryStmt = 216, 197442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19757eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@catch statement. 197642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 197742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtCatchStmt = 217, 197842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19797eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@finally statement. 198042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 198142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtFinallyStmt = 218, 198242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19837eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@throw statement. 198442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 198542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtThrowStmt = 219, 198642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 19877eee0184570366285589d788bcd7f5dda8345915James Dennett /** \brief Objective-C's \@synchronized statement. 198842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 198942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAtSynchronizedStmt = 220, 199042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 199142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's autorelease pool statement. 199242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 199342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCAutoreleasePoolStmt = 221, 199442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 199542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Objective-C's collection statement. 199642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 199742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_ObjCForCollectionStmt = 222, 199842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 199942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s catch statement. 200042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 200142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXCatchStmt = 223, 200242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 200342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s try statement. 200442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 200542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXTryStmt = 224, 200642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 200742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief C++'s for (* : *) statement. 200842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 200942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_CXXForRangeStmt = 225, 201042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 201142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's try statement. 201242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 201342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHTryStmt = 226, 201442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 201542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's except statement. 201642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 201742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHExceptStmt = 227, 201842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 201942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Windows Structured Exception Handling's finally statement. 202042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 202142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_SEHFinallyStmt = 228, 202242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20238cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier /** \brief A MS inline assembly statement extension. 20248cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier */ 20258cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier CXCursor_MSAsmStmt = 229, 20268cd64b4c5553fa6284d248336cb7c82dc960a394Chad Rosier 202742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief The null satement ";": C99 6.8.3p3. 202842b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * 202942b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * This cursor kind is used to describe the null statement. 203042b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 203142b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_NullStmt = 230, 203242b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 203342b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor /** \brief Adaptor class for mixing declarations with statements and 203442b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor * expressions. 203542b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor */ 203642b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor CXCursor_DeclStmt = 231, 203742b2984771a7fd1b17c78bbb2c59fed3db2f1960Douglas Gregor 20384c5fa4292a2ae1fd69c8b984543519c4f119c540Joao Matos CXCursor_LastStmt = CXCursor_DeclStmt, 20391efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2040c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 2041c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Cursor that represents the translation unit itself. 2042c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2043c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor exists primarily to act as the root 2044c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor for traversing the contents of a translation unit. 2045c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2046e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_TranslationUnit = 300, 2047e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 2048ad017fa7a4df7389d245d02a49b3c79ed70bedb9Bill Wendling /* Attributes */ 2049e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_FirstAttr = 400, 2050e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek /** 2051e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * \brief An attribute whose specific kind is not exposed via this 2052e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek * interface. 2053e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek */ 2054e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_UnexposedAttr = 400, 2055e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek 2056e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBActionAttr = 401, 2057e77f443dbca8cdc23e5aa94a2653367e4a7cbe47Ted Kremenek CXCursor_IBOutletAttr = 402, 2058857e918a8a40deb128840308a318bf623d68295fTed Kremenek CXCursor_IBOutletCollectionAttr = 403, 20596639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXFinalAttr = 404, 20606639e9255489ad8e10278d5658fdd4b3c0e1e4cdArgyrios Kyrtzidis CXCursor_CXXOverrideAttr = 405, 20615f1c822def3efffe1d8f7299fbbbc3b1cdd4833dErik Verbruggen CXCursor_AnnotateAttr = 406, 206284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCursor_AsmLabelAttr = 407, 206384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCursor_LastAttr = CXCursor_AsmLabelAttr, 20649f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor 20659f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor /* Preprocessing */ 20669f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_PreprocessingDirective = 500, 2067572feb2a190b5e8b04fb06c4ac50ee0f61e93ff0Douglas Gregor CXCursor_MacroDefinition = 501, 20689b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroExpansion = 502, 20699b2a0ac970a077bdc0bf08c6c682f80ad733c892Chandler Carruth CXCursor_MacroInstantiation = CXCursor_MacroExpansion, 2070ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor CXCursor_InclusionDirective = 503, 20719f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor CXCursor_FirstPreprocessing = CXCursor_PreprocessingDirective, 20726a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_LastPreprocessing = CXCursor_InclusionDirective, 20736a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis 20746a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis /* Extra Declarations */ 20756a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis /** 20766a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis * \brief A module import declaration. 20776a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis */ 20786a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_ModuleImportDecl = 600, 20796a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, 20806a01012e6bffa246810dc5c655a9a30082331fb2Argyrios Kyrtzidis CXCursor_LastExtraDecl = CXCursor_ModuleImportDecl 2081c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 2082c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2083c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2084c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief A cursor representing some element in the abstract syntax tree for 2085c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a translation unit. 2086c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 20871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor abstraction unifies the different kinds of entities in a 2088c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * program--declaration, statements, expressions, references to declarations, 2089c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * etc.--under a single "cursor" abstraction with a common set of operations. 2090c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Common operation for a cursor include: getting the physical location in 2091c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * a source file where the cursor points, getting the name associated with a 2092c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor, and retrieving cursors for any child nodes of a particular cursor. 2093c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2094c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors can be produced in two specific ways. 2095c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_getTranslationUnitCursor() produces a cursor for a translation unit, 2096c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * from which one can use clang_visitChildren() to explore the rest of the 2097c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * translation unit. clang_getCursor() maps from a physical source location 2098c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to the entity that resides at that location, allowing one to map from the 2099c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * source code into the AST. 2100c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2101c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregortypedef struct { 2102c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor enum CXCursorKind kind; 2103aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis int xdata; 210467812b2f94f4b5e7d2596db1705ffa1149ddc45aDmitri Gribenko const void *data[3]; 21051efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar} CXCursor; 2106c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2107c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2108ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A comment AST node. 2109ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 2110ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkotypedef struct { 2111e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko const void *ASTNode; 2112e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri Gribenko CXTranslationUnit TranslationUnit; 2113ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko} CXComment; 2114ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 2115ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 2116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations 2117c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2118c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2119c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 21201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2121c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2122c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the NULL cursor, which represents no entity. 2123c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2124c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getNullCursor(void); 21251efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2126c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2127c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the cursor that represents the given translation unit. 2128c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2129c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The translation unit cursor can be used to start traversing the 2130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * various declarations within the given translation unit. 2131c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2132c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit); 2133c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2134c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2135c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether two cursors are equivalent. 2136c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2137c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor); 21381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2139c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 21401824d54df85a462ada812dadda18130f951d40f3Dmitri Gribenko * \brief Returns non-zero if \p cursor is null. 2141b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 21421824d54df85a462ada812dadda18130f951d40f3Dmitri GribenkoCINDEX_LINKAGE int clang_Cursor_isNull(CXCursor cursor); 2143b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2144b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 21459ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor * \brief Compute a hash value for the given cursor. 21469ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor */ 21479ce5584553054d0cb934940586aca0186e87fa57Douglas GregorCINDEX_LINKAGE unsigned clang_hashCursor(CXCursor); 21489ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor 21499ce5584553054d0cb934940586aca0186e87fa57Douglas Gregor/** 2150c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve the kind of the given cursor. 2151c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2152c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); 2153c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2154c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2155c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a declaration. 2156c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2157c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); 2158c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2159c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2160c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a simple 2161c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * reference. 2162c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2163c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Note that other kinds of cursors (such as expressions) can also refer to 2164c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * other cursors. Use clang_getCursorReferenced() to determine whether a 2165c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * particular cursor refers to another entity. 2166c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2167c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); 2168c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2169c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2170c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents an expression. 2171c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2172c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind); 2173c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2174c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2175c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Determine whether the given cursor kind represents a statement. 2176c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2177c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind); 2178c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2179c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 21808be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor * \brief Determine whether the given cursor kind represents an attribute. 21818be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor */ 21828be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas GregorCINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind); 21838be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor 21848be80e1e6effd5a333bc70e7f030dc9397d0554eDouglas Gregor/** 21851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents an invalid 2186c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor. 21871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar */ 2188c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); 2189c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2190c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 21911efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Determine whether the given cursor kind represents a translation 21921efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unit. 2193c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2194c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind); 21951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2196ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek/*** 21979f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * \brief Determine whether the given cursor represents a preprocessing 21989f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor * element, such as a preprocessor directive or macro instantiation. 21999f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor */ 22009f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas GregorCINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind); 22019f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor 22029f1e3ff3b3095967e2b92b57a53524e2d6bb141cDouglas Gregor/*** 2203ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * \brief Determine whether the given cursor represents a currently 2204ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek * unexposed piece of the AST (e.g., CXCursor_UnexposedStmt). 2205ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek */ 2206ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted KremenekCINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind); 2207ad6eff611a4391f89fd6c458db16993f76e7f5d0Ted Kremenek 2208c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 220916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief Describe the linkage of the entity referred to by a cursor. 221016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 221116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenekenum CXLinkageKind { 221216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This value indicates that no linkage information is available 221316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * for a provided CXCursor. */ 221416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Invalid, 221516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** 221616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * \brief This is the linkage for variables, parameters, and so on that 221716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * have automatic storage. This covers normal (non-extern) local variables. 221816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 221916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_NoLinkage, 222016b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for static variables and static functions. */ 222116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_Internal, 222216b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with external linkage that live 222316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek * in C++ anonymous namespaces.*/ 222416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_UniqueExternal, 222516b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek /** \brief This is the linkage for entities with true, external linkage. */ 222616b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek CXLinkage_External 222716b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek}; 222816b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 222916b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 223045e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the linkage of the entity referred to by a given cursor. 223116b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek */ 223216b4259aecaa22b642d35d36fd89965ed700c1e0Ted KremenekCINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor); 223316b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek 223416b4259aecaa22b642d35d36fd89965ed700c1e0Ted Kremenek/** 2235cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to, 2236cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * taking the current target platform into account. 223758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 223858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param cursor The cursor to query. 223958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 224058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the cursor. 224158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 224258ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 224358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCursorAvailability(CXCursor cursor); 224458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 224558ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 2246cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Describes the availability of a given entity on a particular platform, e.g., 2247cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * a particular class might only be available on Mac OS 10.7 or newer. 2248cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2249cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregortypedef struct CXPlatformAvailability { 2250cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2251cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief A string that describes the platform for which this structure 2252cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provides availability information. 2253cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2254cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Possible values are "ios" or "macosx". 2255cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2256cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString Platform; 2257cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2258cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was introduced. 2259cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2260cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Introduced; 2261cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2262cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was deprecated (but is 2263cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * still available). 2264cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2265cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Deprecated; 2266cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2267cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief The version number in which this entity was obsoleted, and therefore 2268cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is no longer available. 2269cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2270cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXVersion Obsoleted; 2271cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2272cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Whether the entity is unconditionally unavailable on this platform. 2273cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2274cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int Unavailable; 2275cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor /** 2276cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief An optional message to provide to a user of this API, e.g., to 2277cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * suggest replacement APIs. 2278cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2279cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString Message; 2280cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor} CXPlatformAvailability; 2281cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2282cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 2283cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Determine the availability of the entity that this cursor refers to 2284cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * on any platforms for which availability information is known. 2285cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2286cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param cursor The cursor to query. 2287cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2288cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param always_deprecated If non-NULL, will be set to indicate whether the 2289cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is deprecated on all platforms. 2290cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2291cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param deprecated_message If non-NULL, will be set to the message text 2292cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional deprecation of this entity. The client 2293cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * is responsible for deallocating this string. 2294cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 22957eee0184570366285589d788bcd7f5dda8345915James Dennett * \param always_unavailable If non-NULL, will be set to indicate whether the 2296cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * entity is unavailable on all platforms. 2297cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2298cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param unavailable_message If non-NULL, will be set to the message text 2299cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * provided along with the unconditional unavailability of this entity. The 2300cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * client is responsible for deallocating this string. 2301cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2302cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability If non-NULL, an array of CXPlatformAvailability instances 2303cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * that will be populated with platform availability information, up to either 2304cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * the number of platforms for which availability information is available (as 2305cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * returned by this function) or \c availability_size, whichever is smaller. 2306cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2307cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \param availability_size The number of elements available in the 2308cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c availability array. 2309cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2310cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \returns The number of platforms (N) for which availability information is 2311cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * available (which is unrelated to \c availability_size). 2312cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * 2313cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * Note that the client is responsible for calling 2314cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c clang_disposeCXPlatformAvailability to free each of the 2315cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * platform-availability structures returned. There are 2316cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \c min(N, availability_size) such structures. 2317cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2318cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE int 2319cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_getCursorPlatformAvailability(CXCursor cursor, 2320cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int *always_deprecated, 2321cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString *deprecated_message, 2322cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int *always_unavailable, 2323cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXString *unavailable_message, 2324cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor CXPlatformAvailability *availability, 2325cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor int availability_size); 2326cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2327cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 2328cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor * \brief Free the memory associated with a \c CXPlatformAvailability structure. 2329cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor */ 2330cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas GregorCINDEX_LINKAGE void 2331cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregorclang_disposeCXPlatformAvailability(CXPlatformAvailability *availability); 2332cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor 2333cc889664dec7776ebb598e4584e7df5ba2f59ab4Douglas Gregor/** 233445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Describe the "language" of the entity referred to by a cursor. 233545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 233645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind { 23376cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_Invalid = 0, 233845e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_C, 233945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek CXLanguage_ObjC, 23406cd1e7cb04d1da66e8b5675062152ff60bbc354fTed Kremenek CXLanguage_CPlusPlus 234145e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek}; 234245e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 234345e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 234445e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek * \brief Determine the "language" of the entity referred to by a given cursor. 234545e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek */ 234645e1dae500bba7a9ef5b8206263a5609c07c6f03Ted KremenekCINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor); 234745e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek 2348b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis/** 2349b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis * \brief Returns the translation unit that a cursor originated from. 2350b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis */ 2351b0d6eaa6b646c18c49923aefc76973801f561701Argyrios KyrtzidisCINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor); 2352b0d6eaa6b646c18c49923aefc76973801f561701Argyrios Kyrtzidis 2353eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2354eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2355eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief A fast container representing a set of CXCursors. 2356eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2357eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenektypedef struct CXCursorSetImpl *CXCursorSet; 2358eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2359eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2360eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Creates an empty CXCursorSet. 2361eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2362f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXCursorSet clang_createCXCursorSet(void); 2363eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2364eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2365eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Disposes a CXCursorSet and releases its associated memory. 2366eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek */ 2367eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset); 2368eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2369eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2370eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Queries a CXCursorSet to see if it contains a specific CXCursor. 2371eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * 2372eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns non-zero if the set contains the specified cursor. 2373eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/ 2374eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset, 2375eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek CXCursor cursor); 2376eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 2377eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek/** 2378eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \brief Inserts a CXCursor into a CXCursorSet. 2379eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * 2380eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek * \returns zero if the CXCursor was already in the set, and non-zero otherwise. 2381eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek*/ 2382eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted KremenekCINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset, 2383eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek CXCursor cursor); 2384eca099bdb0178d408d4f717c2e9627e0d0e673c6Ted Kremenek 23852be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 23862be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the semantic parent of the given cursor. 23872be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 23882be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The semantic parent of a cursor is the cursor that semantically contains 23892be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the given \p cursor. For many declarations, the lexical and semantic parents 23902be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the lexical parent is returned by 23912be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorLexicalParent()). They diverge when declarations or 23922be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 23932be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 23942be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 23952be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 23962be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 23972be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 23982be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 23992be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 24002be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 24012be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24022be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the 24032be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 24042be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 24052be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the 24062be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 24072be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 24082be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 24092be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 24102be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 24112be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24122be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 24132be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 24142be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 24153910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 24163910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For global declarations, the semantic parent is the translation unit. 24172be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 24182be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor); 24192be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor 24202be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor/** 24212be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \brief Determine the lexical parent of the given cursor. 24222be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24232be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * The lexical parent of a cursor is the cursor in which the given \p cursor 24242be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * was actually written. For many declarations, the lexical and semantic parents 24252be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * are equivalent (the semantic parent is returned by 24262be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \c clang_getCursorSemanticParent()). They diverge when declarations or 24272be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * definitions are provided out-of-line. For example: 24282be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24292be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \code 24302be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * class C { 24312be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void f(); 24322be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * }; 24332be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24342be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * void C::f() { } 24352be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * \endcode 24362be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24372be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the out-of-line definition of \c C::f, the semantic parent is the 24382be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the class \c C, of which this function is a member. The lexical parent is 24392be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * the place where the declaration actually occurs in the source code; in this 24402be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * case, the definition occurs in the translation unit. In general, the 24412be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * lexical parent for a given entity can change without affecting the semantics 24422be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of the program, and the lexical parent of different declarations of the 24432be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * same entity may be different. Changing the semantic parent of a declaration, 24442be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * on the other hand, can have a major impact on semantics, and redeclarations 24452be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * of a particular entity should all have the same semantic context. 24462be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * 24472be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * In the example above, both declarations of \c C::f have \c C as their 24482be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * semantic context, while the lexical context of the first \c C::f is \c C 24492be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor * and the lexical context of the second \c C::f is the translation unit. 24503910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * 24513910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * For declarations written in the global scope, the lexical parent is 24523910cfd17fcd99ac80158e625fc63e4784d26435Douglas Gregor * the translation unit. 24532be5bc9ad3981347a000742f81b91ab3080f1214Douglas Gregor */ 24542be5bc9ad3981347a000742f81b91ab3080f1214Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor); 24559f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 24569f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 24579f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Determine the set of methods that are overridden by the given 24589f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. 24599f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24609f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In both Objective-C and C++, a method (aka virtual member function, 24619f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * in C++) can override a virtual method in a base class. For 24629f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * Objective-C, a method is said to override any method in the class's 2463044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * base class, its protocols, or its categories' protocols, that has the same 2464044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * selector and is of the same kind (class or instance). 2465044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * If no such method exists, the search continues to the class's superclass, 2466044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * its protocols, and its categories, and so on. A method from an Objective-C 2467044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * implementation is considered to override the same methods as its 2468044e645605c6d75223e33d23e3c5701cb389969fArgyrios Kyrtzidis * corresponding method in the interface. 24699f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24709f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * For C++, a virtual member function overrides any virtual member 24719f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * function with the same signature that occurs in its base 24729f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * classes. With multiple inheritance, a virtual member function can 24739f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * override several virtual member functions coming from different 24749f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * base classes. 24759f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24769f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * In all cases, this function determines the immediate overridden 24779f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method, rather than all of the overridden methods. For example, if 24789f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * a method is originally declared in a class A, then overridden in B 24799f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * (which in inherits from A) and also in C (which inherited from B), 24809f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * then the only overridden method returned from this function when 24819f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoked on C's method will be B's method. The client may then 24829f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * invoke this function again, given the previously-found overridden 24839f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods, to map out the complete method-override set. 24849f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24859f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param cursor A cursor representing an Objective-C or C++ 24869f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method. This routine will compute the set of methods that this 24879f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * method overrides. 24889f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24899f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param overridden A pointer whose pointee will be replaced with a 24909f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * pointer to an array of cursors, representing the set of overridden 24919f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * methods. If there are no overridden methods, the pointee will be 24929f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * set to NULL. The pointee must be freed via a call to 24939f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \c clang_disposeOverriddenCursors(). 24949f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * 24959f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \param num_overridden A pointer to the number of overridden 24969f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * functions, will be set to the number of overridden functions in the 24979f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * array pointed to by \p overridden. 24989f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 24999f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor, 25009f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor CXCursor **overridden, 25019f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor unsigned *num_overridden); 25029f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 25039f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor/** 25049f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * \brief Free the set of overridden cursors returned by \c 25059f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor * clang_getOverriddenCursors(). 25069f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor */ 25079f59234a91d057cee7c5e3cee91da8696858c692Douglas GregorCINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden); 25089f59234a91d057cee7c5e3cee91da8696858c692Douglas Gregor 250945e1dae500bba7a9ef5b8206263a5609c07c6f03Ted Kremenek/** 2510ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * \brief Retrieve the file that is included by the given inclusion directive 2511ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor * cursor. 2512ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor */ 2513ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas GregorCINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor); 2514ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor 2515ecdcb883cbc6bb4a2445dc6f02d58d9bdb54a0edDouglas Gregor/** 2516c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2517c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 25181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2519c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2520c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code 2521c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2522c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Cursors represent a location within the Abstract Syntax Tree (AST). These 2523c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines help map between cursors and the physical locations where the 2524c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * described entities occur in the source code. The mapping is provided in 2525c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * both directions, so one can map from source code to the AST and back. 2526c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2527c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 252850398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */ 25291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 25306a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff/** 2531b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \brief Map a source location to the cursor that describes the entity at that 2532b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * location in the source code. 2533b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2534b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() maps an arbitrary source location within a translation 2535b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * unit down to the most specific cursor that describes the entity at that 25361efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * location. For example, given an expression \c x + y, invoking 2537b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * clang_getCursor() with a source location pointing to "x" will return the 25381efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * cursor for "x"; similarly for "y". If the cursor points anywhere between 2539b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor() 2540b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * will return a cursor referring to the "+" expression. 2541b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * 2542b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * \returns a cursor representing the entity at the given source location, or 2543b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas Gregor * a NULL cursor if no such entity can be found. 25446a6de8b4fc944ca1bfa4e47c516d049a0d627b0eSteve Naroff */ 2545b979034b100be14de2223f2b8f6cc7a3275cbe4fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation); 25461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 254798258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor/** 254898258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * \brief Retrieve the physical location of the source constructor referenced 254998258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * by the given cursor. 255098258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * 255198258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * The location of a declaration is typically the location of the name of that 25521efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * declaration, where the name of that declaration would occur if it is 25531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * unnamed, or some keyword that introduces that particular declaration. 25541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The location of a reference is where that reference occurs within the 255598258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor * source code. 255698258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas Gregor */ 255798258afae66bab39b0c57a3efb6b20d4fbb5746cDouglas GregorCINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor); 2558c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2559b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor/** 2560b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Retrieve the physical extent of the source construct referenced by 2561a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the given cursor. 2562a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * 2563a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * The extent of a cursor starts with the file/line/column pointing at the 2564a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * first character within the source construct that the cursor refers to and 25651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * ends with the last character withinin that source construct. For a 2566a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * declaration, the extent covers the declaration itself. For a reference, 2567a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * the extent covers the location of the reference (e.g., where the referenced 2568a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor * entity was actually used). 2569a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas Gregor */ 2570a7bde20f8c6334ccc3a7ef4dd77243d0921a8497Douglas GregorCINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor); 2571c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor 2572c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2573c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 2574c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 257595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 2576c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 25778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \defgroup CINDEX_TYPES Type information for CXCursors 25788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 25798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @{ 25808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 25838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Describes the kind of type 25848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenekenum CXTypeKind { 25868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 25878e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Reprents an invalid type (e.g., where no type is available). 25888e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25898e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Invalid = 0, 25908e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /** 25928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief A type whose specific kind is not exposed via this 25938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * interface. 25948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 25958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Unexposed = 1, 25968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 25978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek /* Builtin types */ 25988e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Void = 2, 25998e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Bool = 3, 26008e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_U = 4, 26018e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UChar = 5, 26028e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char16 = 6, 26038e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char32 = 7, 26048e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UShort = 8, 26058e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt = 9, 26068e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULong = 10, 26078e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ULongLong = 11, 26088e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_UInt128 = 12, 26098e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Char_S = 13, 26108e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_SChar = 14, 26118e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_WChar = 15, 26128e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Short = 16, 26138e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int = 17, 26148e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Long = 18, 26158e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongLong = 19, 26168e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Int128 = 20, 26178e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Float = 21, 26188e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Double = 22, 26198e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LongDouble = 23, 26208e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_NullPtr = 24, 26218e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Overload = 25, 26228e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Dependent = 26, 26238e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCId = 27, 26248e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCClass = 28, 26258e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCSel = 29, 26268e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_FirstBuiltin = CXType_Void, 26278e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LastBuiltin = CXType_ObjCSel, 26288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 26298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Complex = 100, 26308e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Pointer = 101, 26318e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_BlockPointer = 102, 26328e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_LValueReference = 103, 26338e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_RValueReference = 104, 26348e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Record = 105, 26358e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Enum = 106, 26368e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_Typedef = 107, 26378e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek CXType_ObjCInterface = 108, 263804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_ObjCObjectPointer = 109, 263904c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek CXType_FunctionNoProto = 110, 26405f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis CXType_FunctionProto = 111, 264184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXType_ConstantArray = 112, 264284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXType_Vector = 113 26438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek}; 26448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 26458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 264684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Describes the calling convention of a function type 264784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 264884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidisenum CXCallingConv { 264984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Default = 0, 265084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_C = 1, 265184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86StdCall = 2, 265284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86FastCall = 3, 265384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86ThisCall = 4, 265484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_X86Pascal = 5, 265584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS = 6, 265684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_AAPCS_VFP = 7, 2657263366f9241366f29ba65b703120f302490c39ffDerek Schuff CXCallingConv_PnaclCall = 8, 265838980086c0f791e8c23cc882574f18e5b4a87db6Guy Benyei CXCallingConv_IntelOclBicc = 9, 265984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 266084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Invalid = 100, 266184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis CXCallingConv_Unexposed = 200 266284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis}; 266384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 266484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 266584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 26668e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief The type of an element in the abstract syntax tree. 26678e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 26688e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 26698e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenektypedef struct { 26708e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek enum CXTypeKind kind; 26718e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek void *data[2]; 26728e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek} CXType; 26738e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 26748e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 26758e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the type of a CXCursor (if any). 26768e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 26778e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCursorType(CXCursor C); 26788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 26798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 268084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the underlying type of a typedef declaration. 268184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 268284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference a typedef declaration, an invalid type is 268384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 268484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 268584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getTypedefDeclUnderlyingType(CXCursor C); 268684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 268784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 268884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer type of an enum declaration. 268984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 269084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum declaration, an invalid type is 269184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * returned. 269284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 269384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getEnumDeclIntegerType(CXCursor C); 269484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 269584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 269684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as a signed 269784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 269884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 269984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, LLONG_MIN is returned. 270084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 270184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 270284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 270384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getEnumConstantDeclValue(CXCursor C); 270484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 270584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 270684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the integer value of an enum constant declaration as an unsigned 270784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * long long. 270884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 270984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If the cursor does not reference an enum constant declaration, ULLONG_MAX is returned. 271084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * Since this is also potentially a valid constant value, the kind of the cursor 271184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * must be verified before calling this function. 271284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 271384b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned long long clang_getEnumConstantDeclUnsignedValue(CXCursor C); 271484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 271584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 27161eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * \brief Retrieve the bit width of a bit field declaration as an integer. 27171eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * 27181eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko * If a cursor that is not a bit field declaration is passed in, -1 is returned. 27191eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko */ 27201eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri GribenkoCINDEX_LINKAGE int clang_getFieldDeclBitWidth(CXCursor C); 27211eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko 27221eb60825f0b858a4568c1a9497cc61b0d90c9b3aDmitri Gribenko/** 2723d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the number of non-variadic arguments associated with a given 2724d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * cursor. 2725d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * 2726d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a cursor that is not a function or method is passed in, -1 is returned. 2727d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */ 2728d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getNumArguments(CXCursor C); 2729d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis 2730d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/** 2731d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * \brief Retrieve the argument cursor of a function or method. 2732d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * 2733d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a cursor that is not a function or method is passed in or the index 2734d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * exceeds the number of arguments, an invalid cursor is returned. 2735d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis */ 2736d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE CXCursor clang_Cursor_getArgument(CXCursor C, unsigned i); 2737d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis 2738d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis/** 27397eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether two CXTypes represent the same type. 27408e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 27417eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns non-zero if the CXTypes represent the same type and 27427eee0184570366285589d788bcd7f5dda8345915James Dennett * zero otherwise. 27438e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27448e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B); 27458e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27468e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 27478e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the canonical type for a CXType. 27488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * 27498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * Clang's type system explicitly models typedefs and all the ways 27508e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * a specific type can be represented. The canonical type is the underlying 27518e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * type with all the "sugar" removed. For example, if 'T' is a typedef 27528e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * for 'int', the canonical type for 'T' would be 'int'. 27538e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27548e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getCanonicalType(CXType T); 27558e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27568e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 27577eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "const" qualifier set, 27587eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "const" at a 27597eee0184570366285589d788bcd7f5dda8345915James Dennett * different level. 2760e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2761e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T); 2762e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2763e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 27647eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "volatile" qualifier set, 27657eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "volatile" at 27667eee0184570366285589d788bcd7f5dda8345915James Dennett * a different level. 2767e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2768e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T); 2769e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2770e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 27717eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Determine whether a CXType has the "restrict" qualifier set, 27727eee0184570366285589d788bcd7f5dda8345915James Dennett * without looking through typedefs that may have added "restrict" at a 27737eee0184570366285589d788bcd7f5dda8345915James Dennett * different level. 2774e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor */ 2775e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas GregorCINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T); 2776e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor 2777e72fb6f40231a1e8372c7576b69f06f0a1eb28a7Douglas Gregor/** 27788e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief For pointer types, returns the type of the pointee. 27798e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27808e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXType clang_getPointeeType(CXType T); 27818e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27828e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 27838e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Return the cursor for the declaration of the given type. 27848e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27858e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T); 27868e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27875389f48b24937ad7b4093307128b3cbf25235654David Chisnall/** 27885389f48b24937ad7b4093307128b3cbf25235654David Chisnall * Returns the Objective-C type encoding for the specified declaration. 27895389f48b24937ad7b4093307128b3cbf25235654David Chisnall */ 27905389f48b24937ad7b4093307128b3cbf25235654David ChisnallCINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C); 27918e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27928e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 27938e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * \brief Retrieve the spelling of a given CXTypeKind. 27948e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 27958e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted KremenekCINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K); 27968e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 27978e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 279884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the calling convention associated with a function type. 279984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 280084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, CXCallingConv_Invalid is returned. 280184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 280284b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE enum CXCallingConv clang_getFunctionTypeCallingConv(CXType T); 280384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 280484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 28059a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek * \brief Retrieve the result type associated with a function type. 280684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 280784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a non-function type is passed in, an invalid type is returned. 280804c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek */ 280904c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted KremenekCINDEX_LINKAGE CXType clang_getResultType(CXType T); 281004c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek 281104c3cf35a80c09ab78e519f2e71ecccd5c5d8da0Ted Kremenek/** 28127eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Retrieve the number of non-variadic arguments associated with a 28137eee0184570366285589d788bcd7f5dda8345915James Dennett * function type. 281484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 2815d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios Kyrtzidis * If a non-function type is passed in, -1 is returned. 281684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 2817d98ef9ae48ab4090d4d5d703ce65cfac62807fdaArgyrios KyrtzidisCINDEX_LINKAGE int clang_getNumArgTypes(CXType T); 281884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 281984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 282084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the type of an argument of a function type. 282184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 28227eee0184570366285589d788bcd7f5dda8345915James Dennett * If a non-function type is passed in or the function does not have enough 28237eee0184570366285589d788bcd7f5dda8345915James Dennett * parameters, an invalid type is returned. 282484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 282584b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArgType(CXType T, unsigned i); 282684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 282784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 282884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return 1 if the CXType is a variadic function type, and 0 otherwise. 282984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 283084b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_isFunctionTypeVariadic(CXType T); 283184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 283284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 283384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Retrieve the result type associated with a given cursor. 283484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 283584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * This only returns a valid type if the cursor refers to a function or method. 28369a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek */ 28379a140845438c2fc31e7d48a6dedbc695f4c83c68Ted KremenekCINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C); 28389a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek 28399a140845438c2fc31e7d48a6dedbc695f4c83c68Ted Kremenek/** 28403ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * \brief Return 1 if the CXType is a POD (plain old data) type, and 0 28413ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek * otherwise. 28423ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek */ 28433ce9e7d270e7df86c09c8126b4412d55be7c123bTed KremenekCINDEX_LINKAGE unsigned clang_isPODType(CXType T); 28443ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek 28453ce9e7d270e7df86c09c8126b4412d55be7c123bTed Kremenek/** 284684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the element type of an array, complex, or vector type. 284784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 284884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array, complex, or vector type, 284984b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * an invalid type is returned. 285084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 285184b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE CXType clang_getElementType(CXType T); 285284b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 285384b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 285484b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * \brief Return the number of elements of an array or vector type. 285584b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * 285684b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * If a type is passed in that is not an array or vector type, 285784b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis * -1 is returned. 285884b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis */ 285984b796492de8a708150dd3f86ae191041d42eef9Argyrios KyrtzidisCINDEX_LINKAGE long long clang_getNumElements(CXType T); 286084b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis 286184b796492de8a708150dd3f86ae191041d42eef9Argyrios Kyrtzidis/** 28625f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * \brief Return the element type of an array type. 28635f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 28645f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, an invalid type is returned. 28655f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 28665f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_getArrayElementType(CXType T); 28675f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 28685f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 2869bed28ac1d1463adca3ecf24fca5c30646fa9dbb2Sylvestre Ledru * \brief Return the array size of a constant array. 28705f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * 28715f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis * If a non-array type is passed in, -1 is returned. 28725f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis */ 28735f0bfc522266f3319c4a6262b016a552de058c7fArgyrios KyrtzidisCINDEX_LINKAGE long long clang_getArraySize(CXType T); 28745f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis 28755f0bfc522266f3319c4a6262b016a552de058c7fArgyrios Kyrtzidis/** 28763064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns 1 if the base class specified by the cursor with kind 28773064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * CX_CXXBaseSpecifier is virtual. 28783064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 28793064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor); 28803064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 28813064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 28823064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Represents the C++ access control level to a base class for a 28833064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * cursor with kind CX_CXXBaseSpecifier. 28843064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 28853064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenekenum CX_CXXAccessSpecifier { 28863064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXInvalidAccessSpecifier, 28873064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPublic, 28883064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXProtected, 28893064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek CX_CXXPrivate 28903064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek}; 28913064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 28923064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 28933064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek * \brief Returns the access control level for the C++ base specifier 28942dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * represented by a cursor with kind CXCursor_CXXBaseSpecifier or 28952dfdb948bef51a601e763191e4becfe59880d382Argyrios Kyrtzidis * CXCursor_AccessSpecifier. 28963064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek */ 28973064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed KremenekCINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor); 28983064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek 28993064ef9e604d19a0cfd0d8e3ed3055bfd83f88fdTed Kremenek/** 29001f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Determine the number of overloaded declarations referenced by a 29011f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c CXCursor_OverloadedDeclRef cursor. 29021f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 29031f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 29041f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 29051f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns The number of overloaded declarations referenced by \c cursor. If it 29061f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0. 29071f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 29081f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor); 29091f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 29101f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 29111f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \brief Retrieve a cursor for one of the overloaded declarations referenced 29121f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * by a \c CXCursor_OverloadedDeclRef cursor. 29131f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 29141f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param cursor The cursor whose overloaded declarations are being queried. 29151f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 29161f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \param index The zero-based index into the set of overloaded declarations in 29171f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * the cursor. 29181f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * 29191f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \returns A cursor representing the declaration referenced by the given 29201f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * \c cursor at the specified \c index. If the cursor does not have an 29211f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * associated set of overloaded declarations, or if the index is out of bounds, 29221f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor * returns \c clang_getNullCursor(); 29231f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor */ 29241f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas GregorCINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor, 29251f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor unsigned index); 29261f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor 29271f60d9ea523fc321d811fe880ba9a1ec74fa8f9bDouglas Gregor/** 29288e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek * @} 29298e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek */ 293095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 293195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 2932ad72f4dad4cf0fd2b71eb8f4704d2fe7ac58fb44Ted Kremenek * \defgroup CINDEX_ATTRIBUTES Information for attributes 293395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 293495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @{ 293595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 293695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 293795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 293895f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 293995f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * \brief For cursors representing an iboutletcollection attribute, 294095f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * this function returns the collection element type. 294195f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * 294295f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 294395f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted KremenekCINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor); 294495f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek 294595f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek/** 294695f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek * @} 294795f33555a6d51b6537a9ed3968c3d1c2e4991b51Ted Kremenek */ 29488e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek 29498e0ac174c8c8c980927b3e1447f16f62fbe2a2e4Ted Kremenek/** 2950c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors 2951c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2952c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines provide the ability to traverse the abstract syntax tree 2953c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * using cursors. 2954c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2955c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 2956c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 29571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 2958c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2959c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Describes how the traversal of the children of a particular 2960c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * cursor should proceed after visiting a particular child cursor. 2961c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2962c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A value of this enumeration type should be returned by each 2963c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXCursorVisitor to indicate how clang_visitChildren() proceed. 2964c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2965c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregorenum CXChildVisitResult { 2966c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 29671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Terminates the cursor traversal. 2968c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2969c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Break, 29701efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 2971c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Continues the cursor traversal with the next sibling of 2972c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the cursor just visited, without visiting its children. 2973c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2974c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Continue, 2975c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor /** 2976c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Recursively traverse the children of this cursor, using 2977c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the same visitor and client data. 2978c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 2979c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXChildVisit_Recurse 2980c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor}; 2981c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2982c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2983c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visitor invoked for each cursor found by a traversal. 2984c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2985c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This visitor function will be invoked for each cursor found by 2986c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). Its first argument is the cursor being 2987c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited, its second argument is the parent visitor for that cursor, 2988c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and its third argument is the client data provided to 2989c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * clang_visitCursorChildren(). 2990c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 2991c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * The visitor should return one of the \c CXChildVisitResult values 2992c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * to direct clang_visitCursorChildren(). 2993c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 29941efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbartypedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor, 29951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar CXCursor parent, 2996c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 2997c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 2998c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 2999c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Visit the children of a particular cursor. 3000c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3001c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * This function visits all the direct children of the given cursor, 3002c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * invoking the given \p visitor function with the cursors of each 3003c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * visited child. The traversal may be recursive, if the visitor returns 3004c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if 3005c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * the visitor returns \c CXChildVisit_Break. 3006c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3007c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param parent the cursor whose child may be visited. All kinds of 3008a57259e9d7b30bcce93f0a62eee0488738026172Daniel Dunbar * cursors can be visited, including invalid cursors (which, by 3009c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * definition, have no children). 3010c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3011c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param visitor the visitor function that will be invoked for each 3012c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * child of \p parent. 3013c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3014c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \param client_data pointer data supplied by the client, which will 3015c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be passed to the visitor each time it is invoked. 3016c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3017c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \returns a non-zero value if the traversal was terminated 3018c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * prematurely by the visitor returning \c CXChildVisit_Break. 3019c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 30201efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent, 3021c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXCursorVisitor visitor, 3022c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor CXClientData client_data); 30233387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#ifdef __has_feature 30243387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# if __has_feature(blocks) 30253387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 30263387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * \brief Visitor invoked for each cursor found by a traversal. 30273387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 30283387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * This visitor block will be invoked for each cursor found by 30293387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * clang_visitChildrenWithBlock(). Its first argument is the cursor being 30303387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * visited, its second argument is the parent visitor for that cursor. 30313387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * 30323387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * The visitor should return one of the \c CXChildVisitResult values 30333387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * to direct clang_visitChildrenWithBlock(). 30343387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 30353387c65a094a02b2a94c05111d035a97d3d5c794David Chisnalltypedef enum CXChildVisitResult 30363387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent); 30373387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall 30383387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall/** 30393387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * Visits the children of a cursor using the specified block. Behaves 30403387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall * identically to clang_visitChildren() in all other respects. 30413387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall */ 30423387c65a094a02b2a94c05111d035a97d3d5c794David Chisnallunsigned clang_visitChildrenWithBlock(CXCursor parent, 30433387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall CXCursorVisitorBlock block); 30443387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall# endif 30453387c65a094a02b2a94c05111d035a97d3d5c794David Chisnall#endif 30461efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3047c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3048c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3049c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 30501efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3051c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3052c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST 3053c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 30541efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * These routines provide the ability to determine references within and 3055c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * across translation units, by providing the names of the entities referenced 3056c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by cursors, follow reference cursors to the declarations they reference, 3057c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * and associate declarations with their definitions. 3058c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3059c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 3060c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 30611efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3062c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3063c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced 3064c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * by the given cursor. 3065c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 3066c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * A Unified Symbol Resolution (USR) is a string that identifies a particular 3067c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * entity (function, class, variable, etc.) within a program. USRs can be 3068c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * compared across translation units to determine, e.g., when references in 3069c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * one translation refer to an entity defined in another translation unit. 3070c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3071c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor); 3072c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3073c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 3074896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C class. 3075896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3076896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name); 3077896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3078896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3079896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C category. 3080896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3081896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 308266ccaec73706f3623d2e7d191fe2c944feedcc2bTed Kremenek clang_constructUSR_ObjCCategory(const char *class_name, 3083896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek const char *category_name); 3084896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3085896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3086896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C protocol. 3087896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3088896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString 3089896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek clang_constructUSR_ObjCProtocol(const char *protocol_name); 3090896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3091896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3092896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3093896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C instance variable and 3094896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 3095896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3096896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name, 3097896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3098896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3099896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3100896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C method and 3101896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * the USR for its containing class. 3102896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3103896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name, 3104896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek unsigned isInstanceMethod, 3105896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3106896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3107896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3108896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Construct a USR for a specified Objective-C property and the USR 3109896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * for its containing class. 3110896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek */ 3111896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property, 3112896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek CXString classUSR); 3113896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3114896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek/** 3115c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \brief Retrieve a name for the entity referenced by this cursor. 3116c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 3117c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas GregorCINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor); 3118c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor 3119358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor/** 3120ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \brief Retrieve a range for a piece that forms the cursors spelling name. 3121ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * Most of the times there is only one range for the complete spelling but for 3122ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * objc methods and objc message expressions, there are multiple pieces for each 3123ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * selector identifier. 3124ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 3125ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param pieceIndex the index of the spelling name piece. If this is greater 3126ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * than the actual number of pieces, it will return a NULL (invalid) range. 3127ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * 3128ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis * \param options Reserved. 3129ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis */ 3130ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios KyrtzidisCINDEX_LINKAGE CXSourceRange clang_Cursor_getSpellingNameRange(CXCursor, 3131ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned pieceIndex, 3132ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis unsigned options); 3133ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis 3134ba1da14e79c1ecd49306e5175b69baa1e7ed4293Argyrios Kyrtzidis/** 3135358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * \brief Retrieve the display name for the entity referenced by this cursor. 3136358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * 3137358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * The display name contains extra information that helps identify the cursor, 3138358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * such as the parameters of a function or template or the arguments of a 3139358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor * class template specialization. 3140358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor */ 3141358559d8d7b458c5f64941842383a16e61f0828dDouglas GregorCINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor); 3142358559d8d7b458c5f64941842383a16e61f0828dDouglas Gregor 3143c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor/** \brief For a cursor that is a reference, retrieve a cursor representing the 3144c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * entity that it references. 3145c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * 3146c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Reference cursors refer to other entities in the AST. For example, an 3147c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * Objective-C superclass reference cursor refers to an Objective-C class. 31481efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * This function produces the cursor for the Objective-C class from the 3149c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * cursor for the superclass reference. If the input cursor is a declaration or 3150c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor * definition, it returns that declaration or definition unchanged. 31511efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Otherwise, returns the NULL cursor. 3152c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas Gregor */ 3153c5d1e9375d71e66d22456e7cc52cc7c0a5c65c3fDouglas GregorCINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor); 3154b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 31551efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 3156b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief For a cursor that is either a reference to or a declaration 3157b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * of some entity, retrieve a cursor that describes the definition of 3158b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that entity. 3159b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3160b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * Some entities can be declared multiple times within a translation 3161b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * unit, but only one of those declarations can also be a 3162b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * definition. For example, given: 3163b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3164b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \code 3165b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 3166b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int g(int x, int y) { return f(x, y); } 3167b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int a, int b) { return a + b; } 3168b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * int f(int, int); 3169b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \endcode 3170b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3171b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * there are three declarations of the function "f", but only the 3172b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * second one is a definition. The clang_getCursorDefinition() 3173b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * function will take any cursor pointing to a declaration of "f" 3174b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * (the first or fourth lines of the example) or a cursor referenced 3175b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * that uses "f" (the call to "f' inside "g") and will return a 3176b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration cursor pointing to the definition (the second "f" 3177b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * declaration). 3178b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * 3179b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * If given a cursor for which there is no corresponding definition, 3180b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * e.g., because there is no definition of that entity within this 3181b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * translation unit, returns a NULL cursor. 3182b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 3183b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor); 3184b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 31851efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar/** 3186b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * \brief Determine whether the declaration pointed to by this cursor 3187b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor * is also a definition of that entity. 3188b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor */ 3189b699866820102a69d83d6ac6941985c5ef4e8c40Douglas GregorCINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor); 3190b699866820102a69d83d6ac6941985c5ef4e8c40Douglas Gregor 3191c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 31921a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \brief Retrieve the canonical cursor corresponding to the given cursor. 31931a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 31941a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * In the C family of languages, many kinds of entities can be declared several 31951a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * times within a single translation unit. For example, a structure type can 31961a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * be forward-declared (possibly multiple times) and later defined: 31971a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 31981a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \code 31991a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 32001a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X; 32011a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * struct X { 32021a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * int member; 32031a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * }; 32041a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \endcode 32051a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 32061a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * The declarations and the definition of \c X are represented by three 32071a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * different cursors, all of which are declarations of the same underlying 32081a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * entity. One of these cursor is considered the "canonical" cursor, which 32091a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * is effectively the representative for the underlying entity. One can 32101a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * determine if two cursors are declarations of the same underlying entity by 32111a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * comparing their canonical cursors. 32121a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * 32131a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor * \returns The canonical cursor for the entity referred to by the given cursor. 32141a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor */ 32151a9d0503b67a499797141af0fd6d315d5045f0eaDouglas GregorCINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor); 32161a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor 321734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis 321834ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis/** 321934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \brief If the cursor points to a selector identifier in a objc method or 322034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * message expression, this returns the selector index. 322134ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * 32227eee0184570366285589d788bcd7f5dda8345915James Dennett * After getting a cursor with #clang_getCursor, this can be called to 322334ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * determine if the location points to a selector identifier. 322434ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * 322534ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * \returns The selector index if the cursor is an objc method or message 322634ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * expression and the cursor is pointing to a selector identifier, or -1 322734ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis * otherwise. 322834ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis */ 322934ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_getObjCSelectorIndex(CXCursor); 323034ebe1e1b0779bcea2f277bc6b4e9dd98bf70b7bArgyrios Kyrtzidis 32311a9d0503b67a499797141af0fd6d315d5045f0eaDouglas Gregor/** 3232f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * \brief Given a cursor pointing to a C++ method call or an ObjC message, 3233f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * returns non-zero if the method/message is "dynamic", meaning: 3234f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * 3235f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For a C++ method: the call is virtual. 3236f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * For an ObjC message: the receiver is an object instance, not 'super' or a 3237f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * specific class. 3238f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * 3239f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * If the method/message is "static" or the cursor does not point to a 3240f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis * method/message, it will return zero. 3241f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis */ 3242f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios KyrtzidisCINDEX_LINKAGE int clang_Cursor_isDynamicCall(CXCursor C); 3243e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis 3244e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis/** 3245e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * \brief Given a cursor pointing to an ObjC message, returns the CXType of the 3246e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis * receiver. 3247e4a990f34904eb572c8d6aa1deef19465214359cArgyrios Kyrtzidis */ 3248e4a990f34904eb572c8d6aa1deef19465214359cArgyrios KyrtzidisCINDEX_LINKAGE CXType clang_Cursor_getReceiverType(CXCursor C); 3249f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis 3250f39a7aea7dd0bf0716a066e2db2f97ea8730e4faArgyrios Kyrtzidis/** 3251aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated 3252aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment's source range. The range may include multiple consecutive comments 3253aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * with whitespace in between. 3254aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */ 3255aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXSourceRange clang_Cursor_getCommentRange(CXCursor C); 3256aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko 3257aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/** 3258aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * \brief Given a cursor that represents a declaration, return the associated 3259aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko * comment text, including comment markers. 3260aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko */ 3261aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getRawCommentText(CXCursor C); 3262aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko 3263aa0cd85838f2a024e589ea4e8c2094130065af21Dmitri Gribenko/** 3264ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g., 3265ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated \\brief paragraph; otherwise return the 3266ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * first paragraph. 32672d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko */ 32682d44d77fed3200e2eff289f55493317e90d3398cDmitri GribenkoCINDEX_LINKAGE CXString clang_Cursor_getBriefCommentText(CXCursor C); 32692d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko 32702d44d77fed3200e2eff289f55493317e90d3398cDmitri Gribenko/** 3271ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Given a cursor that represents a documentable entity (e.g., 3272ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * declaration), return the associated parsed comment as a 3273ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_FullComment AST node. 3274ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3275ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXComment clang_Cursor_getParsedComment(CXCursor C); 3276ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3277ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3278ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @} 3279ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3280ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3281ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 32825d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \defgroup CINDEX_MODULE Module introspection 32835d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 32845d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * The functions in this group provide access to information about modules. 32855d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 32865d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @{ 32875d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 32885d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 32895d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidistypedef void *CXModule; 32905d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 32915d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 32925d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \brief Given a CXCursor_ModuleImportDecl cursor, return the associated module. 32935d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 32945d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Cursor_getModule(CXCursor C); 32955d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 32965d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3297d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 32985d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 32995d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the parent of a sub-module or NULL if the given module is top-level, 33005d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * e.g. for 'std.vector' it will return the 'std' module. 33015d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3302d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXModule clang_Module_getParent(CXModule Module); 33035d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33045d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3305d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 33065d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 33075d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the name of the module, e.g. for the 'std.vector' sub-module it 33085d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * will return "vector". 33095d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3310d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getName(CXModule Module); 33115d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33125d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3313d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 33145d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 33155d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the full name of the module, e.g. "std.vector". 33165d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3317d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE CXString clang_Module_getFullName(CXModule Module); 33185d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33195d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3320d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 33215d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 33225d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the number of top level headers associated with this module. 33235d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3324d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_Module_getNumTopLevelHeaders(CXModule Module); 33255d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33265d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3327d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios Kyrtzidis * \param Module a module object. 33285d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 33295d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \param Index top level header index (zero-based). 33305d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * 33315d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * \returns the specified top level header associated with the module. 33325d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 3333d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCINDEX_LINKAGE 3334d29245ce5ed1f6aee6f056c85ba77b009f11ee83Argyrios KyrtzidisCXFile clang_Module_getTopLevelHeader(CXModule Module, unsigned Index); 33355d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33365d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 33375d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis * @} 33385d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis */ 33395d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis 33405d04b1af7b76ed536557d4bba24005ad0d2fd608Argyrios Kyrtzidis/** 3341ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \defgroup CINDEX_COMMENT Comment AST introspection 3342ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3343ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * The routines in this group provide access to information in the 3344ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * documentation comment ASTs. 3345ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3346ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * @{ 3347ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3348ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3349ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3350ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes the type of the comment AST node (\c CXComment). A comment 3351ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node can be considered block content (e. g., paragraph), inline content 3352ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * (plain text) or neither (the root AST node). 3353ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3354ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentKind { 3355ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3356ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Null comment. No AST node is constructed at the requested location 3357ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * because there is no text or a syntax error. 3358ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3359ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_Null = 0, 3360ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3361ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3362ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Plain text. Inline content. 3363ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3364ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_Text = 1, 3365ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3366ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3367ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A command with word-like arguments that is considered inline content. 3368ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3369ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * For example: \\c command. 3370ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3371ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_InlineCommand = 2, 3372ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3373ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3374ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief HTML start tag with attributes (name-value pairs). Considered 3375ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * inline content. 3376ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3377ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * For example: 3378ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \verbatim 3379ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * <br> <br /> <a href="http://example.org/"> 3380ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \endverbatim 3381ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3382ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_HTMLStartTag = 3, 3383ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3384ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3385ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief HTML end tag. Considered inline content. 3386ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3387ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * For example: 3388ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \verbatim 3389ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * </a> 3390ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \endverbatim 3391ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3392ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_HTMLEndTag = 4, 3393ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3394ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3395ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A paragraph, contains inline comment. The paragraph itself is 3396ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * block content. 3397ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3398ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_Paragraph = 5, 3399ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3400ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3401ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A command that has zero or more word-like arguments (number of 3402ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * word-like arguments depends on command name) and a paragraph as an 3403ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * argument. Block command is block content. 3404ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3405ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Paragraph argument is also a child of the block command. 3406ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3407ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * For example: \\brief has 0 word-like arguments and a paragraph argument. 3408ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3409ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * AST nodes of special kinds that parser knows about (e. g., \\param 3410ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * command) have their own node kinds. 3411ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3412ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_BlockCommand = 6, 3413ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3414ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3415ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A \\param or \\arg command that describes the function parameter 3416ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * (name, passing direction, description). 3417ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 341870517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko * For example: \\param [in] ParamName description. 3419ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3420ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment_ParamCommand = 7, 3421ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3422ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 342396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \brief A \\tparam command that describes a template parameter (name and 342496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * description). 342596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 342670517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko * For example: \\tparam T description. 342796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */ 342896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko CXComment_TParamCommand = 8, 342996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko 343096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko /** 3431ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A verbatim block command (e. g., preformatted code). Verbatim 3432ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * block has an opening and a closing command and contains multiple lines of 3433ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * text (\c CXComment_VerbatimBlockLine child nodes). 3434ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3435ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * For example: 3436ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \\verbatim 3437ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * aaa 3438ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \\endverbatim 3439ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 344096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko CXComment_VerbatimBlockCommand = 9, 3441ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3442ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3443ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A line of text that is contained within a 3444ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * CXComment_VerbatimBlockCommand node. 3445ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 344696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko CXComment_VerbatimBlockLine = 10, 3447ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3448ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3449ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A verbatim line command. Verbatim line has an opening command, 3450ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * a single line of text (up to the newline after the opening command) and 3451ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * has no closing command. 3452ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 345396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko CXComment_VerbatimLine = 11, 3454ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3455ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3456ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A full comment attached to a declaration, contains block content. 3457ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 345896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko CXComment_FullComment = 12 3459ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko}; 3460ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3461ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 34622d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief The most appropriate rendering mode for an inline command, chosen on 34632d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * command semantics in Doxygen. 34642d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 34652d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoenum CXCommentInlineCommandRenderKind { 34662d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko /** 34672d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief Command argument should be rendered in a normal font. 34682d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 34692d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko CXCommentInlineCommandRenderKind_Normal, 34702d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko 34712d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko /** 34722d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief Command argument should be rendered in a bold font. 34732d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 34742d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko CXCommentInlineCommandRenderKind_Bold, 34752d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko 34762d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko /** 34772d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief Command argument should be rendered in a monospaced font. 34782d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 34792d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko CXCommentInlineCommandRenderKind_Monospaced, 34802d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko 34812d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko /** 34822d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \brief Command argument should be rendered emphasized (typically italic 34832d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * font). 34842d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 34852d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko CXCommentInlineCommandRenderKind_Emphasized 34862d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko}; 34872d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko 34882d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/** 3489ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Describes parameter passing direction for \\param or \\arg command. 3490ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3491ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection { 3492ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3493ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief The parameter is an input parameter. 3494ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3495ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXCommentParamPassDirection_In, 3496ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3497ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3498ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief The parameter is an output parameter. 3499ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3500ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXCommentParamPassDirection_Out, 3501ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3502ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko /** 3503ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief The parameter is an input and output parameter. 3504ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3505ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXCommentParamPassDirection_InOut 3506ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko}; 3507ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3508ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3509ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind. 3510ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3511ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the type of the AST node. 3512ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3513ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE enum CXCommentKind clang_Comment_getKind(CXComment Comment); 3514ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3515ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3516ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind. 3517ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3518ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of children of the AST node. 3519ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3520ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_getNumChildren(CXComment Comment); 3521ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3522ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3523ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment AST node of any kind. 3524ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 352570517ca5c07c4b41ff8662b94ee22047b0299f8cDmitri Gribenko * \param ChildIdx child index (zero-based). 3526ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3527ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns the specified child of the AST node. 3528ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3529ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3530ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_Comment_getChild(CXComment Comment, unsigned ChildIdx); 3531ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3532ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3533ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief A \c CXComment_Paragraph node is considered whitespace if it contains 3534ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * only \c CXComment_Text nodes that are empty or whitespace. 3535ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3536ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are 3537ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * never considered whitespace. 3538ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3539ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is whitespace. 3540ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3541ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_Comment_isWhitespace(CXComment Comment); 3542ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3543ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3544ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if \c Comment is inline content and has a newline 3545ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * immediately following it in the comment text. Newlines between paragraphs 3546ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * do not count. 3547ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3548ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3549ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineContentComment_hasTrailingNewline(CXComment Comment); 3550ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3551ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3552ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_Text AST node. 3553ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3554ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node. 3555ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3556ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_TextComment_getText(CXComment Comment); 3557ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3558ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3559ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node. 3560ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3561ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the inline command. 3562ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3563ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3564ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getCommandName(CXComment Comment); 3565ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3566ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3567ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node. 3568ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 35692d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \returns the most appropriate rendering mode, chosen on command 35702d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * semantics in Doxygen. 35712d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko */ 35722d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri GribenkoCINDEX_LINKAGE enum CXCommentInlineCommandRenderKind 35732d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenkoclang_InlineCommandComment_getRenderKind(CXComment Comment); 35742d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko 35752d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko/** 35762d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node. 35772d66a5016d4aacce362f89290261c8a1a6eef0d3Dmitri Gribenko * 3578ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of command arguments. 3579ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3580ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3581ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_InlineCommandComment_getNumArgs(CXComment Comment); 3582ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3583ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3584ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_InlineCommand AST node. 3585ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3586ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based). 3587ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3588ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified argument. 3589ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3590ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3591ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_InlineCommandComment_getArgText(CXComment Comment, 3592ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko unsigned ArgIdx); 3593ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3594ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3595ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST 3596ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node. 3597ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3598ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns HTML tag name. 3599ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3600ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getTagName(CXComment Comment); 3601ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3602ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3603ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node. 3604ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3605ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if tag is self-closing (for example, <br />). 3606ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3607ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3608ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_HTMLStartTagComment_isSelfClosing(CXComment Comment); 3609ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3610ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3611ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node. 3612ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3613ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of attributes (name-value pairs) attached to the start tag. 3614ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3615ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE unsigned clang_HTMLStartTag_getNumAttrs(CXComment Comment); 3616ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3617ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3618ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node. 3619ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3620ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based). 3621ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3622ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the specified attribute. 3623ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3624ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3625ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrName(CXComment Comment, unsigned AttrIdx); 3626ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3627ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3628ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag AST node. 3629ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3630ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param AttrIdx attribute index (zero-based). 3631ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3632ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns value of the specified attribute. 3633ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3634ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3635ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_HTMLStartTag_getAttrValue(CXComment Comment, unsigned AttrIdx); 3636ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3637ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3638ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node. 3639ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3640ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns name of the block command. 3641ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3642ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3643ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getCommandName(CXComment Comment); 3644ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3645ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3646ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node. 3647ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3648ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns number of word-like arguments. 3649ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3650ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3651ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_BlockCommandComment_getNumArgs(CXComment Comment); 3652ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3653ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3654ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand AST node. 3655ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3656ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param ArgIdx argument index (zero-based). 3657ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3658ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text of the specified word-like argument. 3659ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3660ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3661ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_BlockCommandComment_getArgText(CXComment Comment, 3662ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko unsigned ArgIdx); 3663ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3664ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3665ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_BlockCommand or 3666ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \c CXComment_VerbatimBlockCommand AST node. 3667ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3668ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns paragraph argument of the block command. 3669ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3670ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3671ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXComment clang_BlockCommandComment_getParagraph(CXComment Comment); 3672ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3673ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3674ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node. 3675ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3676ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter name. 3677ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3678ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3679ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_ParamCommandComment_getParamName(CXComment Comment); 3680ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3681ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3682ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node. 3683ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3684ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found 3685ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * in the function prototype and \c clang_ParamCommandComment_getParamIndex 3686ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * function will return a meaningful value. 3687ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3688ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3689ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isParamIndexValid(CXComment Comment); 3690ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3691ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3692ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node. 3693ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3694ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns zero-based parameter index in function prototype. 3695ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3696ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3697ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_getParamIndex(CXComment Comment); 3698ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3699ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3700ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node. 3701ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3702ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns non-zero if parameter passing direction was specified explicitly in 3703ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * the comment. 3704ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3705ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3706ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkounsigned clang_ParamCommandComment_isDirectionExplicit(CXComment Comment); 3707ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3708ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3709ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_ParamCommand AST node. 3710ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3711ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns parameter passing direction. 3712ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3713ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3714ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenkoenum CXCommentParamPassDirection clang_ParamCommandComment_getDirection( 3715ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko CXComment Comment); 3716ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3717ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 371896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node. 371996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 372096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns template parameter name. 372196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */ 372296b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE 372396b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCXString clang_TParamCommandComment_getParamName(CXComment Comment); 372496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko 372596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/** 372696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node. 372796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 372896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns non-zero if the parameter that this AST node represents was found 372996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * in the template parameter list and 373096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getDepth and 373196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \c clang_TParamCommandComment_getIndex functions will return a meaningful 373296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * value. 373396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */ 373496b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE 373596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_isParamPositionValid(CXComment Comment); 373696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko 373796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/** 373896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node. 373996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 374096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based nesting depth of this parameter in the template parameter list. 374196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 374296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example, 374396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim 374496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * template<typename C, template<typename T> class TT> 374596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * void test(TT<int> aaa); 374696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim 374796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0, 374896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for T nesting depth is 1. 374996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */ 375096b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE 375196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getDepth(CXComment Comment); 375296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko 375396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/** 375496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \param Comment a \c CXComment_TParamCommand AST node. 375596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 375696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \returns zero-based parameter index in the template parameter list at a 375796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * given nesting depth. 375896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 375996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For example, 376096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \verbatim 376196b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * template<typename C, template<typename T> class TT> 376296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * void test(TT<int> aaa); 376396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \endverbatim 376496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * for C and TT nesting depth is 0, so we can ask for index at depth 0: 376596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 C's index is 0, TT's index is 1. 376696b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 376796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * For T nesting depth is 1, so we can ask for index at depth 0 and 1: 376896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 0 T's index is 1 (same as TT's), 376996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * at depth 1 T's index is 0. 377096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko */ 377196b098674908eaa59a9128f3305cda6fbbdad563Dmitri GribenkoCINDEX_LINKAGE 377296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenkounsigned clang_TParamCommandComment_getIndex(CXComment Comment, unsigned Depth); 377396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko 377496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko/** 3775ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimBlockLine AST node. 3776ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3777ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node. 3778ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3779ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE 3780ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCXString clang_VerbatimBlockLineComment_getText(CXComment Comment); 3781ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3782ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3783ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_VerbatimLine AST node. 3784ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3785ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns text contained in the AST node. 3786ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3787ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_VerbatimLineComment_getText(CXComment Comment); 3788ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3789ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3790ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert an HTML tag AST node to string. 3791ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3792ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST 3793ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * node. 3794ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3795ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML tag. 3796ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3797ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_HTMLTagComment_getAsString(CXComment Comment); 3798ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3799ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3800ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \brief Convert a given full parsed comment to an HTML fragment. 3801ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3802ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Specific details of HTML layout are subject to change. Don't try to parse 3803ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * this HTML back into an AST, use other APIs instead. 3804ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3805ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * Currently the following CSS classes are used: 3806ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-brief" for \\brief paragraph and equivalent commands; 3807ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "para-returns" for \\returns paragraph and equivalent commands; 3808ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \li "word-returns" for the "Returns" word in \\returns paragraph. 3809ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 38103e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * Function argument documentation is rendered as a \<dl\> list with arguments 38113e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * sorted in function prototype order. CSS classes used: 38123e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-NUMBER" for parameter name (\<dt\>); 38133e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-descr-index-NUMBER" for parameter description (\<dd\>); 38143e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * \li "param-name-index-invalid" and "param-descr-index-invalid" are used if 38153e63d332baf0d3b8a5c0b7c2dac2ae85615b1d47Dmitri Gribenko * parameter index is invalid. 3816ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 381796b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * Template parameter documentation is rendered as a \<dl\> list with 381896b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameters sorted in template parameter list order. CSS classes used: 381996b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-NUMBER" for parameter name (\<dt\>); 382096b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>); 38216a425525e52aba5a8e14db35d50a712be4e5e2e1Dmitri Gribenko * \li "tparam-name-index-other" and "tparam-descr-index-other" are used for 382296b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * names inside template template parameters; 382396b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if 382496b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * parameter position is invalid. 382596b098674908eaa59a9128f3305cda6fbbdad563Dmitri Gribenko * 3826ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \param Comment a \c CXComment_FullComment AST node. 3827ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * 3828ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko * \returns string containing an HTML fragment. 3829ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko */ 3830ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsHTML(CXComment Comment); 3831ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko 3832ae99b75fbbac1deaccdcc1b326b8fb6b07a1e72dDmitri Gribenko/** 3833f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \brief Convert a given full parsed comment to an XML document. 3834f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * 3835f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * A Relax NG schema for the XML can be found in comment-xml-schema.rng file 3836f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * inside clang source tree. 3837f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * 3838f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \param Comment a \c CXComment_FullComment AST node. 3839f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * 3840f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko * \returns string containing an XML document. 3841f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko */ 3842e4330a302ac20b41b9800267ebd4b5b01f8553f8Dmitri GribenkoCINDEX_LINKAGE CXString clang_FullComment_getAsXML(CXComment Comment); 3843f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko 3844f303d4cb10648ac9c2080ae7c9dd507ba615e3a7Dmitri Gribenko/** 3845c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 3846c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 38471efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 3848c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 38499ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * \defgroup CINDEX_CPP C++ AST introspection 38509ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 38519ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * The routines in this group provide access information in the ASTs specific 38529ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * to C++ language features. 38539ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * 38549ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @{ 38559ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 38569ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 38579ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 385849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Determine if a C++ member function or member function template is 385949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared 'static'. 38609ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 38619ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed KremenekCINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C); 38629ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 38639ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 3864211924b563aa31421836cee7655be729ad02733fDouglas Gregor * \brief Determine if a C++ member function or member function template is 3865211924b563aa31421836cee7655be729ad02733fDouglas Gregor * explicitly declared 'virtual' or if it overrides a virtual method from 3866211924b563aa31421836cee7655be729ad02733fDouglas Gregor * one of the base classes. 3867211924b563aa31421836cee7655be729ad02733fDouglas Gregor */ 3868211924b563aa31421836cee7655be729ad02733fDouglas GregorCINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C); 3869211924b563aa31421836cee7655be729ad02733fDouglas Gregor 3870211924b563aa31421836cee7655be729ad02733fDouglas Gregor/** 387149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \brief Given a cursor that represents a template, determine 387249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the cursor kind of the specializations would be generated by instantiating 387349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * the template. 387449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 387549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * This routine can be used to determine what flavor of function template, 387649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * class template, or class template partial specialization is stored in the 387749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * cursor. For example, it can describe whether a class template cursor is 387849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declared with "struct", "class" or "union". 387949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 388049f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \param C The cursor to query. This cursor should represent a template 388149f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * declaration. 388249f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * 388349f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \returns The cursor kind of the specializations that would be generated 388449f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * by instantiating the template \p C. If \p C is not a template, returns 388549f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor * \c CXCursor_NoDeclFound. 388649f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor */ 388749f6f5489483beaffc7ce48dfc000af4e65b9216Douglas GregorCINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C); 388849f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor 388949f6f5489483beaffc7ce48dfc000af4e65b9216Douglas Gregor/** 3890e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \brief Given a cursor that may represent a specialization or instantiation 3891e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template, retrieve the cursor that represents the template that it 3892e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializes or from which it was instantiated. 3893e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3894e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * This routine determines the template involved both for explicit 3895e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specializations of templates and for implicit instantiations of the template, 3896e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * both of which are referred to as "specializations". For a class template 3897e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * specialization (e.g., \c std::vector<bool>), this routine will return 3898e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * either the primary template (\c std::vector) or, if the specialization was 3899e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * instantiated from a class template partial specialization, the class template 3900e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * partial specialization. For a class template partial specialization and a 3901e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * function template specialization (including instantiations), this 3902e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * this routine will return the specialized template. 3903e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3904e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * For members of a class template (e.g., member functions, member classes, or 3905e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * static data members), returns the specialized or instantiated member. 3906e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * Although not strictly "templates" in the C++ language, members of class 3907e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates have the same notions of specializations and instantiations that 3908e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * templates do, so this routine treats them similarly. 3909e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3910e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \param C A cursor that may be a specialization of a template or a member 3911e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * of a template. 3912e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * 3913e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * \returns If the given cursor is a specialization or instantiation of a 3914e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * template or a member thereof, the template or member that it specializes or 3915e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor * from which it was instantiated. Otherwise, returns a NULL cursor. 3916e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor */ 3917e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas GregorCINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C); 3918430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3919430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor/** 3920430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Given a cursor that references something else, return the source range 3921430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * covering that reference. 3922430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3923430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param C A cursor pointing to a member reference, a declaration reference, or 3924430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * an operator call. 3925430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param NameFlags A bitset with three independent flags: 3926430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and 3927430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece. 3928430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \param PieceIndex For contiguous names or when passing the flag 3929430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * CXNameRange_WantSinglePiece, only one piece with index 0 is 3930430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * available. When the CXNameRange_WantSinglePiece flag is not passed for a 393148d798ce32447607144db70a484cdb99c1180663Benjamin Kramer * non-contiguous names, this index can be used to retrieve the individual 3932430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * pieces of the name. See also CXNameRange_WantSinglePiece. 3933430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3934430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \returns The piece of the name pointed to by the given cursor. If there is no 3935430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * name, or if the PieceIndex is out-of-range, a null-cursor will be returned. 3936430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 393748a8d14fc6f064a5297024c2b34733a4080b2efeFrancois PichetCINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C, 393848a8d14fc6f064a5297024c2b34733a4080b2efeFrancois Pichet unsigned NameFlags, 3939430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor unsigned PieceIndex); 3940430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3941430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregorenum CXNameRefFlags { 3942430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3943430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the 3944430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * range. 3945430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3946430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantQualifier = 0x1, 3947430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3948430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 39497eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Include the explicit template arguments, e.g. \<int> in x.f<int>, 39507eee0184570366285589d788bcd7f5dda8345915James Dennett * in the range. 3951430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3952430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantTemplateArgs = 0x2, 3953430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor 3954430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor /** 3955430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \brief If the name is non-contiguous, return the full spanning range. 3956430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * 3957430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * Non-contiguous names occur in Objective-C when a selector with two or more 3958430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * parameters is used, or in C++ when using an operator: 3959430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \code 3960430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * [object doSomething:here withValue:there]; // ObjC 3961430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * return some_vector[1]; // C++ 3962430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor * \endcode 3963430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor */ 3964430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor CXNameRange_WantSinglePiece = 0x4 3965430d7a1a621a126a9ffe442ad8987ba02b46dae9Douglas Gregor}; 3966e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor 3967e0329acf5c9437e2086a2fb2bf7a95ae2ac96505Douglas Gregor/** 39689ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek * @} 39699ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek */ 39709ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek 39719ada39a4ac82ff5f5087b0a7fa9ed0d32be55a3bTed Kremenek/** 39720045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \defgroup CINDEX_LEX Token extraction and manipulation 39730045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 39740045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * The routines in this group provide access to the tokens within a 39750045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * translation unit, along with a semantic mapping of those tokens to 39760045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * their corresponding cursors. 3977fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 3978fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @{ 3979fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3980fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 3981fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 3982fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a kind of token. 3983fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3984fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef enum CXTokenKind { 3985fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3986fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A token that contains some kind of punctuation. 3987fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3988fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Punctuation, 3989896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3990fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 39910045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * \brief A language keyword. 3992fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3993fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Keyword, 3994896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 3995fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 3996fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief An identifier (that is not a keyword). 3997fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 3998fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Identifier, 3999896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4000fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 4001fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A numeric, string, or character literal. 4002fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4003fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Literal, 4004896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4005fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor /** 4006fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief A comment. 4007fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4008fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken_Comment 4009fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXTokenKind; 4010fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 4011fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4012fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Describes a single preprocessing token. 4013fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4014fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregortypedef struct { 4015fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor unsigned int_data[4]; 4016fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor void *ptr_data; 4017fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor} CXToken; 4018fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 4019fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4020fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the kind of the given token. 4021fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4022fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken); 4023896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4024fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4025fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Determine the spelling of the given token. 4026fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4027fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * The spelling of a token is the textual representation of that token, e.g., 4028fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * the text of an identifier or keyword. 4029fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4030fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken); 4031896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4032fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4033fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve the source location of the given token. 4034fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4035896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit, 4036fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken); 4037896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4038fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4039fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Retrieve a source range that covers the given token. 4040fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4041fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken); 4042fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor 4043fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4044fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Tokenize the source code described by the given range into raw 4045fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * lexical tokens. 4046fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4047fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit whose text is being tokenized. 4048fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4049fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Range the source range in which text should be tokenized. All of the 4050fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * tokens produced by tokenization will fall within this source range, 4051fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4052fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens this pointer will be set to point to the array of tokens 4053fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that occur within the given source range. The returned pointer must be 4054fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * freed with clang_disposeTokens() before the translation unit is destroyed. 4055fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4056fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens will be set to the number of tokens in the \c *Tokens 4057fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * array. 4058fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4059fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4060fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, 4061fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken **Tokens, unsigned *NumTokens); 4062896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4063fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4064fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Annotate the given set of tokens by providing cursors for each token 4065fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * that can be mapped to a specific entity within the abstract syntax tree. 4066fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 40670045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * This token-annotation routine is equivalent to invoking 40680045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() for the source locations of each of the 40690045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * tokens. The cursors provided are filtered, so that only those 40700045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * cursors that have a direct correspondence to the token are 40710045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * accepted. For example, given a function call \c f(x), 40720045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * clang_getCursor() would provide the following cursors: 40730045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 40740045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'. 40750045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'. 40760045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'. 40770045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * 40780045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * Only the first and last of these cursors will occur within the 40790045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * annotate, since the tokens "f" and "x' directly refer to a function 40800045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * and a variable, respectively, but the parentheses are just a small 40810045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * part of the full syntax of the function call expression, which is 40820045e9fe1f7dfc37f1ea7bdb9b70bcdb6700f0c0Douglas Gregor * not provided as an annotation. 4083fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4084fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param TU the translation unit that owns the given tokens. 4085fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4086fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Tokens the set of tokens to annotate. 4087fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4088fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param NumTokens the number of tokens in \p Tokens. 4089fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * 4090fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \param Cursors an array of \p NumTokens cursors, whose contents will be 4091fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * replaced with the cursors corresponding to each token. 4092fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4093fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas GregorCINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU, 4094fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens, 4095fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXCursor *Cursors); 4096896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4097fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4098fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * \brief Free the given set of tokens. 4099fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4100896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU, 4101fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor CXToken *Tokens, unsigned NumTokens); 4102896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4103fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4104fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor * @} 4105fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor */ 4106896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek 4107fc8ea23eb6cbaaa5046f2abb4c033e24c8659efdDouglas Gregor/** 4108c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_DEBUG Debugging facilities 4109c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 4110c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * These routines are used for testing and debugging, only, and should not 4111c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * be relied upon. 4112c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 4113c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 4114c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 41151efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 41164ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */ 4117e68fff6fc083c6270d835216a3de0b82c6ef0310Ted KremenekCINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind); 41181efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, 41191efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar const char **startBuf, 41204ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff const char **endBuf, 41214ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startLine, 41224ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *startColumn, 41234ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endLine, 41244ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff unsigned *endColumn); 41250a812cf707da15dadd19fdeb0178b9707f4e01a6Douglas GregorCINDEX_LINKAGE void clang_enableStackTraces(void); 4126995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel DunbarCINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data, 4127995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar unsigned stack_size); 4128995aaf9c8f0131bef0215a9a0bc794b83a49e0b7Daniel Dunbar 41290c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 4130c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 4131c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 41321efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 4133c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 4134c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * \defgroup CINDEX_CODE_COMPLET Code completion 4135c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 4136c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * Code completion involves taking an (incomplete) source file, along with 4137c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * knowledge of where the user is actively editing that file, and suggesting 4138c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * syntactically- and semantically-valid constructs that the user might want to 4139c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * use at that particular point in the source code. These data structures and 4140c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * routines provide support for code completion. 4141c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * 4142c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @{ 4143c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 41441efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 4145c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 41460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A semantic string that describes a code-completion result. 41470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A semantic string that describes the formatting of a code-completion 41490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * result as a single "template" of text that should be inserted into the 41500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * source buffer when a particular code-completion result is selected. 41510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * Each semantic string is made up of some number of "chunks", each of which 41520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * contains some text along with a description of what that text means, e.g., 41530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the name of the entity being referenced, whether the text chunk is part of 41540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the template, or whether it is a "placeholder" that the user should replace 41550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * with actual code,of a specific kind. See \c CXCompletionChunkKind for a 41561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * description of the different kinds of chunks. 41570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef void *CXCompletionString; 41591efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 41600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 41610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A single result of code completion. 41620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregortypedef struct { 41640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41651efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief The kind of entity that this completion refers to. 41660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * The cursor kind will be a macro, keyword, or a declaration (one of the 41680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * *Decl cursor kinds), describing the entity that the completion is 41690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to. 41700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \todo In the future, we would like to provide a full cursor, to allow 41720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the client to extract additional information from declaration. 41730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor enum CXCursorKind CursorKind; 41751efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 41761efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar /** 41770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief The code-completion string that describes how to insert this 41780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion result into the editing buffer. 41790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionString CompletionString; 41810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor} CXCompletionResult; 41820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 41830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 41840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Describes a single piece of text within a code-completion string. 41850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41861efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * Each "chunk" within a code-completion string (\c CXCompletionString) is 41871efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * either a piece of text with a specific "kind" that describes how that text 41880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * should be interpreted by the client or is another completion string. 41890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 41900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorenum CXCompletionChunkKind { 41910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 41920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A code-completion string that describes "optional" text that 41930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * could be a part of the template (but is not required). 41940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 41950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The Optional chunk is the only kind of chunk that has a code-completion 41961efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * string for its representation, which is accessible via 41970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \c clang_getCompletionChunkCompletionString(). The code-completion string 41980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * describes an additional part of the template that is completely optional. 41990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * For example, optional chunks can be used to describe the placeholders for 42000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * arguments that match up with defaulted function parameters, e.g. given: 42010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 42030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * void f(int x, float y = 3.14, double z = 2.71828); 42040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 42050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * The code-completion string for this function would contain: 42070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a TypedText chunk for "f". 42080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a LeftParen chunk for "(". 42090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "int x" 42100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the remaining defaulted arguments, e.g., 42110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 421271570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * - a Placeholder chunk for "float y" 42130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - an Optional chunk containing the last defaulted argument: 42140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Comma chunk for "," 42150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a Placeholder chunk for "double z" 42160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - a RightParen chunk for ")" 42170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 421871570182471d502a97f7f175aa527152544c75f2Daniel Dunbar * There are many ways to handle Optional chunks. Two simple approaches are: 42190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Completely ignore optional chunks, in which case the template for the 42200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would only include the first parameter ("int x"). 42210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * - Fully expand all optional chunks, in which case the template for the 42220c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * function "f" would have all of the parameters. 42230c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42240c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Optional, 42250c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42260c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that a user would be expected to type to get this 42271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * code-completion result. 42280c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42291efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * There will be exactly one "typed text" chunk in a semantic string, which 42301efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * will typically provide the spelling of a keyword or the name of a 42310c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * declaration that could be used at the current code point. Clients are 42320c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * expected to filter the code-completion results based on the text in this 42330c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * chunk. 42340c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42350c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_TypedText, 42360c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42370c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that should be inserted as part of a code-completion result. 42380c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42390c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "text" chunk represents text that is part of the template to be 42400c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * inserted into user code should this particular code-completion result 42410c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * be selected. 42420c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42430c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Text, 42440c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42450c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Placeholder text that should be replaced by the user. 42460c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42470c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "placeholder" chunk marks a place where the user should insert text 42480c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * into the code-completion template. For example, placeholders might mark 42490c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the function parameters for a function declaration, to indicate that the 42500c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * user should provide arguments for each of those parameters. The actual 42510c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * text in a placeholder is a suggestion for the text to display before 42520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * the user replaces the placeholder with real code. 42530c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Placeholder, 42550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Informative text that should be displayed but never inserted as 42570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * part of the template. 42581efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * 42590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * An "informative" chunk contains annotations that can be displayed to 42600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * help the user decide whether a particular code-completion result is the 42610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * right option, but which is not part of the actual template to be inserted 42620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * by code completion. 42630c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_Informative, 42650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42660c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Text that describes the current parameter when code-completion is 42670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * referring to function call, message send, or template specialization. 42680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * A "current parameter" chunk occurs when code-completion is providing 42700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * information about a parameter corresponding to the argument at the 42710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * code-completion point. For example, given a function 42720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \code 42740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * int add(int x, int y); 42750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \endcode 42760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 42770c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * and the source code \c add(, where the code-completion point is after the 42780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "(", the code-completion string will contain a "current parameter" chunk 42790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * for "int x", indicating that the current argument will initialize that 42800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * parameter. After typing further, to \c add(17, (where the code-completion 42811efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * point is after the ","), the code-completion string will contain a 42820c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * "current paremeter" chunk to "int y". 42830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_CurrentParameter, 42850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left parenthesis ('('), used to initiate a function call or 42870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the beginning of a function parameter list. 42880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftParen, 42900c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right parenthesis (')'), used to finish a function call or 42920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * signal the end of a function parameter list. 42930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightParen, 42950c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 42960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left bracket ('['). 42970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 42980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBracket, 42990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right bracket (']'). 43010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBracket, 43030c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43040c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left brace ('{'). 43050c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43060c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftBrace, 43070c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43080c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right brace ('}'). 43090c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43100c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightBrace, 43110c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43120c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A left angle bracket ('<'). 43130c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43140c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_LeftAngle, 43150c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43160c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A right angle bracket ('>'). 43170c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43180c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor CXCompletionChunk_RightAngle, 43190c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor /** 43200c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief A comma separator (','). 43210c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 4322ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor CXCompletionChunk_Comma, 4323ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor /** 43241efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Text that specifies the result type of a given result. 4325ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * 4326ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * This special kind of informative chunk is not meant to be inserted into 43271efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * the text buffer. Rather, it is meant to illustrate the type that an 4328ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor * expression using the given completion string would have. 4329ff5ce6eefc7c253ef6edf4d4bfc996fdd82d09aaDouglas Gregor */ 433001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_ResultType, 433101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 433201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A colon (':'). 433301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 433401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Colon, 433501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 433601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief A semicolon (';'). 433701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 433801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_SemiColon, 433901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 434001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * \brief An '=' sign. 434101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 434201dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_Equal, 434301dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 434401dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Horizontal space (' '). 434501dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 434601dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_HorizontalSpace, 434701dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor /** 434801dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * Vertical space ('\n'), after which it is generally a good idea to 434901dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor * perform indentation. 435001dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor */ 435101dfea02d1da297e8b53db8eea3d3cc652acda8dDouglas Gregor CXCompletionChunk_VerticalSpace 43520c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor}; 43531efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 43540c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 43550c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Determine the kind of a particular chunk within a completion string. 43560c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43570c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 43580c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43590c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 43600c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43610c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the kind of the chunk at the index \c chunk_number. 43620c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43631efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE enum CXCompletionChunkKind 43640c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkKind(CXCompletionString completion_string, 43650c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 43661efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 43670c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 43681efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the text associated with a particular chunk within a 43690c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * completion string. 43700c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43710c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 43720c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43730c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 43740c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43750c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the text associated with the chunk at index \c chunk_number. 43760c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43772ef6f8f5a35a60870594c5b04e0aa2bf22c6886fTed KremenekCINDEX_LINKAGE CXString 43780c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkText(CXCompletionString completion_string, 43790c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 43800c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 43810c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 43821efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar * \brief Retrieve the completion string associated with a particular chunk 43830c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * within a completion string. 43840c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43850c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param completion_string the completion string to query. 43860c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43870c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \param chunk_number the 0-based index of the chunk in the completion string. 43880c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * 43890c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \returns the completion string associated with the chunk at index 43906164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c chunk_number. 43910c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43920c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE CXCompletionString 43930c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getCompletionChunkCompletionString(CXCompletionString completion_string, 43940c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor unsigned chunk_number); 43951efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 43960c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 43970c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor * \brief Retrieve the number of chunks in the given code-completion string. 43980c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 43990c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas GregorCINDEX_LINKAGE unsigned 44000c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregorclang_getNumCompletionChunks(CXCompletionString completion_string); 44010c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor 44020c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor/** 440312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \brief Determine the priority of this code completion. 440412e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 440512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * The priority of a code completion indicates how likely it is that this 440612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * particular completion is the completion that the user will select. The 440712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * priority is selected by various internal heuristics. 440812e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 440912e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \param completion_string The completion string to query. 441012e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * 441112e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * \returns The priority of this completion string. Smaller values indicate 441212e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor * higher-priority (more likely) completions. 441312e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor */ 441412e131385e892e3723483a1081a89bcad29c8a84Douglas GregorCINDEX_LINKAGE unsigned 441512e131385e892e3723483a1081a89bcad29c8a84Douglas Gregorclang_getCompletionPriority(CXCompletionString completion_string); 441612e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor 441712e131385e892e3723483a1081a89bcad29c8a84Douglas Gregor/** 441858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \brief Determine the availability of the entity that this code-completion 441958ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * string refers to. 442058ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 442158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \param completion_string The completion string to query. 442258ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * 442358ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor * \returns The availability of the completion string. 442458ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor */ 442558ddb60f409125eda5436c4a1f070f7fa4744295Douglas GregorCINDEX_LINKAGE enum CXAvailabilityKind 442658ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregorclang_getCompletionAvailability(CXCompletionString completion_string); 442758ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 442858ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor/** 44296164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the number of annotations associated with the given 44306164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 44316164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 44326164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 44336164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 44346164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns the number of annotations associated with the given completion 44356164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * string. 44366164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 44376164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE unsigned 44386164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionNumAnnotations(CXCompletionString completion_string); 44396164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 44406164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 44416164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \brief Retrieve the annotation associated with the given completion string. 44426164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 44436164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param completion_string the completion string to query. 44446164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 44456164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \param annotation_number the 0-based index of the annotation of the 44466164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * completion string. 44476164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * 44486164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \returns annotation string associated with the completion at index 44496164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen * \c annotation_number, or a NULL string if that annotation is not available. 44506164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen */ 44516164ea1d75385b6fc3c19e5ab9bb686298436a5aErik VerbruggenCINDEX_LINKAGE CXString 44526164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggenclang_getCompletionAnnotation(CXCompletionString completion_string, 44536164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen unsigned annotation_number); 44546164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen 44556164ea1d75385b6fc3c19e5ab9bb686298436a5aErik Verbruggen/** 4456ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \brief Retrieve the parent context of the given completion string. 4457ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4458ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * The parent context of a completion string is the semantic parent of 4459ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the declaration (if any) that the code completion represents. For example, 4460ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * a code completion for an Objective-C method would have the method's class 4461ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * or protocol as its context. 4462ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4463ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * \param completion_string The code completion string whose parent is 4464ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * being queried. 4465ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 4466526d24444c91404dc4165b141e5ec095125c1bc8Argyrios Kyrtzidis * \param kind DEPRECATED: always set to CXCursor_NotImplemented if non-NULL. 4467ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * 44687eee0184570366285589d788bcd7f5dda8345915James Dennett * \returns The name of the completion parent, e.g., "NSObject" if 4469ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor * the completion string represents a method in the NSObject class. 4470ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor */ 4471ba1030698dbc276db86b11c5329a1edee8a1805eDouglas GregorCINDEX_LINKAGE CXString 4472ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregorclang_getCompletionParent(CXCompletionString completion_string, 4473ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor enum CXCursorKind *kind); 4474d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4475d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko/** 4476d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Retrieve the brief documentation comment attached to the declaration 4477d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * that corresponds to the given completion string. 4478d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 4479d99ef536b241071b6f4c01db6525dc03242ac30bDmitri GribenkoCINDEX_LINKAGE CXString 4480d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenkoclang_getCompletionBriefComment(CXCompletionString completion_string); 4481d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4482ba1030698dbc276db86b11c5329a1edee8a1805eDouglas Gregor/** 44838fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \brief Retrieve a completion string for an arbitrary declaration or macro 44848fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursor. 44858fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 44868fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \param cursor The cursor to query. 44878fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * 44888fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * \returns A non-context-sensitive completion string for declaration and macro 44898fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor * definition cursors, or NULL for other kinds of cursors. 44908fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor */ 44918fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas GregorCINDEX_LINKAGE CXCompletionString 44928fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregorclang_getCursorCompletionString(CXCursor cursor); 44938fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor 44948fa0a80b4482ad94e82c4a19e23de17fd69140b5Douglas Gregor/** 4495ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Contains the results of code-completion. 4496ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * 4497ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * This data structure contains the results of code completion, as 4498e0cc52ef8afc8d1cba9c534191b5f0ddaff1d694Douglas Gregor * produced by \c clang_codeCompleteAt(). Its contents must be freed by 4499ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c clang_disposeCodeCompleteResults. 4500ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4501ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregortypedef struct { 4502ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 4503ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The code-completion results. 4504ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4505ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor CXCompletionResult *Results; 4506ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 4507ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor /** 4508ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief The number of code-completion results stored in the 4509ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \c Results array. 4510ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor */ 4511ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor unsigned NumResults; 4512ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor} CXCodeCompleteResults; 4513ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor 4514ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor/** 4515cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Flags that can be passed to \c clang_codeCompleteAt() to 4516cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * modify its behavior. 4517cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 4518cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * The enumerators in this enumeration can be bitwise-OR'd together to 4519cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * provide multiple options to \c clang_codeCompleteAt(). 4520cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4521cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregorenum CXCodeComplete_Flags { 4522cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 4523cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include macros within the set of code 4524cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completions returned. 4525cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4526cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor CXCodeComplete_IncludeMacros = 0x01, 4527cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4528cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor /** 4529cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Whether to include code patterns for language constructs 4530cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * within the set of code completions, e.g., for loops. 4531cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4532d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXCodeComplete_IncludeCodePatterns = 0x02, 4533d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko 4534d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko /** 4535d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * \brief Whether to include brief documentation within the set of code 4536d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko * completions returned. 4537d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko */ 4538d99ef536b241071b6f4c01db6525dc03242ac30bDmitri Gribenko CXCodeComplete_IncludeBriefComments = 0x04 4539cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor}; 4540cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4541cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 45423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Bits that represent the context under which completion is occurring. 45433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 45443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * The enumerators in this enumeration may be bitwise-OR'd together if multiple 45453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * contexts are occurring simultaneously. 45463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorenum CXCompletionContext { 45483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The context for completions is unexposed, as only Clang results 45503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included. (This is equivalent to having no context bits set.) 45513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unexposed = 0, 45533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible type should be included in the results. 45563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyType = 1 << 0, 45583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for any possible value (variables, function calls, etc.) 45613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 45623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_AnyValue = 1 << 1, 45643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C object should 45663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * be included in the results. 45673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCObjectValue = 1 << 2, 45693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to an Objective-C selector 45713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * should be included in the results. 45723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45733da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorValue = 1 << 3, 45743da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45753da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for values that resolve to a C++ class type should be 45763da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 45773da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45783da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_CXXClassTypeValue = 1 << 4, 45793da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45803da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45813da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the dot 45823da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 45833da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45843da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_DotMemberAccess = 1 << 5, 45853da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45863da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for fields of the member being accessed using the arrow 45873da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * operator should be included in the results. 45883da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45893da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ArrowMemberAccess = 1 << 6, 45903da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45913da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for properties of the Objective-C object being accessed 45923da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * using the dot operator should be included in the results. 45933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCPropertyAccess = 1 << 7, 45953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 45963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 45973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for enum tags should be included in the results. 45983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 45993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_EnumTag = 1 << 8, 46003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for union tags should be included in the results. 46023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_UnionTag = 1 << 9, 46043da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46053da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for struct tags should be included in the results. 46063da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46073da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_StructTag = 1 << 10, 46083da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46093da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46103da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ class names should be included in the results. 46113da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46123da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ClassTag = 1 << 11, 46133da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46143da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ namespaces and namespace aliases should be 46153da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * included in the results. 46163da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46173da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Namespace = 1 << 12, 46183da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46193da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for C++ nested name specifiers should be included in 46203da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46213da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46223da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NestedNameSpecifier = 1 << 13, 46233da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46243da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46253da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C interfaces (classes) should be included 46263da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 46273da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46283da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInterface = 1 << 14, 46293da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46303da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C protocols should be included in 46313da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46323da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46333da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCProtocol = 1 << 15, 46343da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46353da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C categories should be included in 46363da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46383da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCCategory = 1 << 16, 46393da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46403da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C instance messages should be included 46413da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * in the results. 46423da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46433da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCInstanceMessage = 1 << 17, 46443da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46453da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C class messages should be included in 46463da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46473da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46483da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCClassMessage = 1 << 18, 46493da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46503da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for Objective-C selector names should be included in 46513da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46523da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_ObjCSelectorName = 1 << 19, 46543da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46553da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46563da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Completions for preprocessor macro names should be included in 46573da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the results. 46583da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46593da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_MacroName = 1 << 20, 46603da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46613da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46623da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Natural language completions should be included in the results. 46633da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46643da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_NaturalLanguage = 1 << 21, 46653da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46663da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor /** 46673da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief The current context is unknown, so set all contexts. 46683da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 46693da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCompletionContext_Unknown = ((1 << 22) - 1) 46703da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor}; 46713da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 46723da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 4673cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \brief Returns a default set of code-completion options that can be 4674cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * passed to\c clang_codeCompleteAt(). 4675cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor */ 4676cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas GregorCINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void); 4677cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor 4678cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor/** 46791abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \brief Perform code completion at a given location in a translation unit. 46801abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 46811abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * This function performs code completion at a particular file, line, and 46821abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * column within source code, providing results that suggest potential 46831abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code snippets based on the context of the completion. The basic model 46841abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * for code completion is that Clang will parse a complete source file, 46851abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * performing syntax checking up to the location where code-completion has 46861abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * been requested. At that point, a special code-completion token is passed 46871abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * to the parser, which recognizes this token and determines, based on the 46881abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * current location in the C/Objective-C/C++ grammar and the state of 46891abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * semantic analysis, what completions to provide. These completions are 46901abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * returned via a new \c CXCodeCompleteResults structure. 46911abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 46921abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Code completion itself is meant to be triggered by the client when the 46931abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * user types punctuation characters or whitespace, at which point the 46941abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * code-completion location will coincide with the cursor. For example, if \c p 46951abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is a pointer, code-completion might be triggered after the "-" and then 46961abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * after the ">" in \c p->. When the code-completion location is afer the ">", 46971abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the completion results will provide, e.g., the members of the struct that 46981abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * "p" points to. The client is responsible for placing the cursor at the 46991abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * beginning of the token currently being typed, then filtering the results 47001abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * based on the contents of the token. For example, when code-completing for 47011abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the expression \c p->get, the client should provide the location just after 47021abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the 47031abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client can filter the results based on the current token text ("get"), only 47041abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * showing those results that start with "get". The intent of this interface 47051abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * is to separate the relatively high-latency acquisition of code-completion 47061abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * results from the filtering of results on a per-character basis, which must 47071abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * have a lower latency. 47081abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47091abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param TU The translation unit in which code-completion should 47101abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * occur. The source files for this translation unit need not be 47111abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completely up-to-date (and the contents of those source files may 47121abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * be overridden via \p unsaved_files). Cursors referring into the 47131abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * translation unit may be invalidated by this invocation. 47141abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47151abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_filename The name of the source file where code 47161abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion should be performed. This filename may be any file 47171abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * included in the translation unit. 47181abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47191abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_line The line at which code-completion should occur. 47201abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47211abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param complete_column The column at which code-completion should occur. 47221abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * Note that the column should point just after the syntactic construct that 47231abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * initiated code completion, and not in the middle of a lexical token. 47241abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47251abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param unsaved_files the Tiles that have not yet been saved to disk 47261abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * but may be required for parsing or code completion, including the 47271abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * contents of those files. The contents and name of these files (as 47281abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * specified by CXUnsavedFile) are copied when necessary, so the 47291abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * client only needs to guarantee their validity until the call to 47301abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * this function returns. 47311abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 47321abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \param num_unsaved_files The number of unsaved file entries in \p 47331abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * unsaved_files. 47341abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * 4735cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \param options Extra options that control the behavior of code 4736cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * completion, expressed as a bitwise OR of the enumerators of the 4737cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * CXCodeComplete_Flags enumeration. The 4738cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * \c clang_defaultCodeCompleteOptions() function returns a default set 4739cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * of code-completion options. 4740cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor * 47411abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * \returns If successful, a new \c CXCodeCompleteResults structure 47421abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * containing code-completion results, which should eventually be 47431abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * freed with \c clang_disposeCodeCompleteResults(). If code 47441abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor * completion fails, returns NULL. 47451abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor */ 47461abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCINDEX_LINKAGE 47471abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas GregorCXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU, 47481abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor const char *complete_filename, 47491abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_line, 47501abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor unsigned complete_column, 47511abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor struct CXUnsavedFile *unsaved_files, 4752cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned num_unsaved_files, 4753cee235cdf0b8047761ffac598c4c3a32ab7411a2Douglas Gregor unsigned options); 47541abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor 47551abc6bca3d7fb0e7b1e40fbcad6cfb5e10594548Douglas Gregor/** 47561e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \brief Sort the code-completion results in case-insensitive alphabetical 47571e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * order. 47581e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * 47591e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param Results The set of results to sort. 47601e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor * \param NumResults The number of results in \p Results. 47611e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor */ 47621e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas GregorCINDEX_LINKAGE 47631e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregorvoid clang_sortCodeCompletionResults(CXCompletionResult *Results, 47641e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor unsigned NumResults); 47651e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor 47661e5e6684b0f27701e6f7c65f8c6a32a10cbcc3edDouglas Gregor/** 4767ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregor * \brief Free the given set of code-completion results. 47680c8296dfb495f41d6f0de6fe1d03014ffd063674Douglas Gregor */ 47691efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel DunbarCINDEX_LINKAGE 4770ec6762c709726bf2ee5f76c21df81e71a56e6f81Douglas Gregorvoid clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results); 477158ddb60f409125eda5436c4a1f070f7fa4744295Douglas Gregor 477220d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor/** 4773a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Determine the number of diagnostics produced prior to the 4774a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * location where code completion was performed. 4775a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 4776896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 4777a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregorunsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results); 4778a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 4779a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 4780a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \brief Retrieve a diagnostic associated with the given code completion. 4781a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 47827eee0184570366285589d788bcd7f5dda8345915James Dennett * \param Results the code completion results to query. 4783a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \param Index the zero-based diagnostic number to retrieve. 4784a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * 4785a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * \returns the requested diagnostic. This diagnostic must be freed 4786a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor * via a call to \c clang_disposeDiagnostic(). 4787a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor */ 4788896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted KremenekCINDEX_LINKAGE 4789a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas GregorCXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results, 4790a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor unsigned Index); 4791a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor 4792a88084b78fd4ca5d3d858c14b02414f8cc399f02Douglas Gregor/** 47933da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \brief Determines what compeltions are appropriate for the context 47943da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * the given code completion. 47953da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 47963da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \param Results the code completion results to query 47973da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * 47983da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * \returns the kinds of completions that are appropriate for use 47993da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor * along with the given code completion results. 48003da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor */ 48013da626b4f38eb0350de960d71271ca77af7a9cc8Douglas GregorCINDEX_LINKAGE 48023da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregorunsigned long long clang_codeCompleteGetContexts( 48033da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor CXCodeCompleteResults *Results); 4804e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 4805e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 4806e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the cursor kind for the container for the current code 4807e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * completion context. The container is only guaranteed to be set for 4808e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * contexts where a container exists (i.e. member accesses or Objective-C 4809e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * message sends); if there is not a container, this function will return 4810e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * CXCursor_InvalidCode. 4811e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4812e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 4813e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4814e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param IsIncomplete on return, this value will be false if Clang has complete 4815e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information about the container. If Clang does not have complete 4816e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * information, this value will be true. 4817e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4818e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the container kind, or CXCursor_InvalidCode if there is not a 4819e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * container 4820e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 4821e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 4822e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregorenum CXCursorKind clang_codeCompleteGetContainerKind( 4823e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor CXCodeCompleteResults *Results, 4824e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor unsigned *IsIncomplete); 4825e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor 4826e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor/** 4827e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \brief Returns the USR for the container for the current code completion 4828e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * context. If there is not a container for the current context, this 4829e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * function will return the empty string. 4830e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4831e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \param Results the code completion results to query 4832e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * 4833e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor * \returns the USR for the container 4834e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas Gregor */ 4835e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCINDEX_LINKAGE 4836e081a61bb0dc546fd623bf259435d17c9a4ea0d5Douglas GregorCXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results); 48373da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor 48380a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 48390a47d69af8bda945352997af3da4687a3356096aDouglas Gregor/** 48400a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \brief Returns the currently-entered selector for an Objective-C message 48410a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * send, formatted like "initWithFoo:bar:". Only guaranteed to return a 48420a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * non-empty string for CXCompletionContext_ObjCInstanceMessage and 48430a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * CXCompletionContext_ObjCClassMessage. 48440a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 48450a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \param Results the code completion results to query 48460a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * 48470a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * \returns the selector (or partial selector) that has been entered thus far 48480a47d69af8bda945352997af3da4687a3356096aDouglas Gregor * for an Objective-C message send. 48490a47d69af8bda945352997af3da4687a3356096aDouglas Gregor */ 48500a47d69af8bda945352997af3da4687a3356096aDouglas GregorCINDEX_LINKAGE 48510a47d69af8bda945352997af3da4687a3356096aDouglas GregorCXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results); 48520a47d69af8bda945352997af3da4687a3356096aDouglas Gregor 48533da626b4f38eb0350de960d71271ca77af7a9cc8Douglas Gregor/** 485420d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor * @} 485520d416c36b46dd19ee0b1ea2d0266ae43be86e51Douglas Gregor */ 48561efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 48571efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 485804bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek/** 485904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * \defgroup CINDEX_MISC Miscellaneous utility functions 486004bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * 486104bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @{ 486204bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 486323e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek 486423e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek/** 486523e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * \brief Return a version string, suitable for showing to a user, but not 486623e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek * intended to be parsed (the format is not guaranteed to be stable). 486723e1ad09bb68f929212e0ff51206258d06e7f6cfTed Kremenek */ 4868f9c21665faa7e4936d484396469ee7afc46e1f00NAKAMURA TakumiCINDEX_LINKAGE CXString clang_getClangVersion(void); 486904bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek 4870d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 4871d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek/** 4872d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * \brief Enable/disable crash recovery. 4873d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek * 48747eee0184570366285589d788bcd7f5dda8345915James Dennett * \param isEnabled Flag to indicate if crash recovery is enabled. A non-zero 48757eee0184570366285589d788bcd7f5dda8345915James Dennett * value enables crash recovery, while 0 disables it. 4876d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek */ 4877d2427ddf00aacdc288c386f3882e0821ca9bd27bTed KremenekCINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled); 4878d2427ddf00aacdc288c386f3882e0821ca9bd27bTed Kremenek 487916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek /** 4880896b70ffc348f6e2c680b5fb5841984d5785b7b5Ted Kremenek * \brief Visitor invoked for each file in a translation unit 488116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * (used with clang_getInclusions()). 488216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * 488316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * This visitor function will be invoked by clang_getInclusions() for each 48847eee0184570366285589d788bcd7f5dda8345915James Dennett * file included (either at the top-level or by \#include directives) within 488516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * a translation unit. The first argument is the file being included, and 488616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the second and third arguments provide the inclusion stack. The 488716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * array is sorted in order of immediate inclusion. For example, 488816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * the first element refers to the location that included 'included_file'. 488916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 489016b55a71695a33c094383295cc7b7a2080e098daTed Kremenektypedef void (*CXInclusionVisitor)(CXFile included_file, 489116b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXSourceLocation* inclusion_stack, 489216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek unsigned include_len, 489316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 489416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 489516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 489616b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * \brief Visit the set of preprocessor inclusions in a translation unit. 489716b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * The visitor function is called with the provided data for every included 489816b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * file. This does not include headers included by the PCH file (unless one 489916b55a71695a33c094383295cc7b7a2080e098daTed Kremenek * is inspecting the inclusions in the PCH file itself). 490016b55a71695a33c094383295cc7b7a2080e098daTed Kremenek */ 490116b55a71695a33c094383295cc7b7a2080e098daTed KremenekCINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu, 490216b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXInclusionVisitor visitor, 490316b55a71695a33c094383295cc7b7a2080e098daTed Kremenek CXClientData client_data); 490416b55a71695a33c094383295cc7b7a2080e098daTed Kremenek 490516b55a71695a33c094383295cc7b7a2080e098daTed Kremenek/** 490604bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek * @} 490704bb716aea8fd2372ac10b0c640cabc5e5caa615Ted Kremenek */ 49081efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 490997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** \defgroup CINDEX_REMAPPING Remapping functions 491097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 491197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @{ 491297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 491397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 491497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 491597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief A remapping of original source files and their translated files. 491697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 491797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidistypedef void *CXRemapping; 491897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 491997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 492097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Retrieve a remapping. 492197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 492297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param path the path that contains metadata about remappings. 492397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 492497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \returns the requested remapping. This remapping must be freed 492597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 492697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 492797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path); 492897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 492997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 493030660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \brief Retrieve a remapping. 493130660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 493230660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param filePaths pointer to an array of file paths containing remapping info. 493330660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 493430660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \param numFiles number of file paths. 493530660a898545416f0fea2d717f16f75640001e38Ted Kremenek * 493630660a898545416f0fea2d717f16f75640001e38Ted Kremenek * \returns the requested remapping. This remapping must be freed 493730660a898545416f0fea2d717f16f75640001e38Ted Kremenek * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred. 493830660a898545416f0fea2d717f16f75640001e38Ted Kremenek */ 493930660a898545416f0fea2d717f16f75640001e38Ted KremenekCINDEX_LINKAGE 494030660a898545416f0fea2d717f16f75640001e38Ted KremenekCXRemapping clang_getRemappingsFromFileList(const char **filePaths, 494130660a898545416f0fea2d717f16f75640001e38Ted Kremenek unsigned numFiles); 494230660a898545416f0fea2d717f16f75640001e38Ted Kremenek 494330660a898545416f0fea2d717f16f75640001e38Ted Kremenek/** 494497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Determine the number of remappings. 494597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 494697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping); 494797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 494897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 494997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Get the original and the associated filename from the remapping. 495097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 495197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param original If non-NULL, will be set to the original filename. 495297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * 495397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \param transformed If non-NULL, will be set to the filename that the original 495497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * is associated with. 495597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 495697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index, 495797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis CXString *original, CXString *transformed); 495897c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 495997c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 496097c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * \brief Dispose the remapping. 496197c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 496297c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios KyrtzidisCINDEX_LINKAGE void clang_remap_dispose(CXRemapping); 496397c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 496497c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis/** 496597c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis * @} 496697c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis */ 496797c337c2bdf3ec53073c7e7dd656aa0dd37ee409Argyrios Kyrtzidis 4968aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** \defgroup CINDEX_HIGH Higher level API functions 4969aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4970aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @{ 4971aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4972aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4973aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisenum CXVisitorResult { 4974aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Break, 4975aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXVisit_Continue 4976aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis}; 4977aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4978aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef struct { 4979aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis void *context; 4980aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis enum CXVisitorResult (*visit)(void *context, CXCursor, CXSourceRange); 4981aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis} CXCursorAndRangeVisitor; 4982aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4983aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 4984aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \brief Find references of a declaration in a specific file. 4985aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4986aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param cursor pointing to a declaration or a reference of one. 4987aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4988aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param file to search for references. 4989aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * 4990aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * \param visitor callback that will receive pairs of CXCursor/CXSourceRange for 4991aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * each reference found. 4992aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * The CXSourceRange will point inside the file; if the reference is inside 4993aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * a macro (and not a macro argument) the CXSourceRange will be invalid. 4994aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 4995aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE void clang_findReferencesInFile(CXCursor cursor, CXFile file, 4996aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXCursorAndRangeVisitor visitor); 4997aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 4998aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#ifdef __has_feature 4999aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# if __has_feature(blocks) 5000aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5001aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidistypedef enum CXVisitorResult 5002aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis (^CXCursorAndRangeVisitorBlock)(CXCursor, CXSourceRange); 5003aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5004aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios KyrtzidisCINDEX_LINKAGE 5005aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidisvoid clang_findReferencesInFileWithBlock(CXCursor, CXFile, 5006aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis CXCursorAndRangeVisitorBlock); 5007aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5008aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis# endif 5009aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis#endif 5010aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5011bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5012bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a CXFile. 5013bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5014dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientFile; 5015bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 5016bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 50172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic entity. 50182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 50192957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIdxClientEntity; 50202957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 50212957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 5022bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with a semantic container 5023bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * of entities. 5024bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5025dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientContainer; 5026bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis 5027bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5028bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The client's data object that is associated with an AST file (PCH 5029bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * or module). 5030bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5031dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef void *CXIdxClientASTFile; 50324e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5033bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5034dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis * \brief Source location passed to index callbacks. 5035bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 50364e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 50374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void *ptr_data[2]; 50384e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned int_data; 50394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxLoc; 50404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5041bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 50427eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for ppIncludedFile callback. 5043bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 50444e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5045bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 50467eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Location of '#' in the \#include/\#import directive. 5047bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 50484e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc hashLoc; 5049bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 50507eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Filename as written in the \#include/\#import directive. 5051bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 50524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *filename; 5053bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 50547eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief The actual file that the \#include/\#import directive resolved to. 5055bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5056dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXFile file; 50574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isImport; 50584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isAngled; 50598d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis /** 50608d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis * \brief Non-zero if the directive was automatically turned into a module 50618d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis * import. 50628d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis */ 50638d7a24e94b58676e57fd3f47353cbdbc59917d81Argyrios Kyrtzidis int isModuleImport; 50644e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxIncludedFileInfo; 50654e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5066bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 50677eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#importedASTFile. 5068bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 50694e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 50702c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis /** 50712c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * \brief Top level AST file containing the imported PCH, module or submodule. 50722c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis */ 50734e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile file; 5074bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5075134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * \brief The imported module or NULL if the AST file is a PCH. 5076bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5077134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis CXModule module; 5078bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5079134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * \brief Location where the file is imported. Applicable only for modules. 5080bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5081134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis CXIdxLoc loc; 50822c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis /** 50832c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * \brief Non-zero if an inclusion directive was automatically turned into 5084134d1e8a0b463d929ffeac5eefeae761707bf5d3Argyrios Kyrtzidis * a module import. Applicable only for modules. 50852c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis */ 508637f2f52fbc16b0d426d4d86c7e1662e5c6b9e3b8Argyrios Kyrtzidis int isImplicit; 50872c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis 50884e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxImportedASTFileInfo; 50894e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5090dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 5091dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Unexposed = 0, 5092dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Typedef = 1, 5093dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Function = 2, 5094dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Variable = 3, 5095dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_Field = 4, 5096dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_EnumConstant = 5, 50974e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5098dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCClass = 6, 5099dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCProtocol = 7, 5100dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxEntity_ObjCCategory = 8, 51014e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5102c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCInstanceMethod = 9, 5103c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCClassMethod = 10, 5104c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCProperty = 11, 5105c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_ObjCIvar = 12, 51064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5107c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Enum = 13, 5108c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Struct = 14, 5109c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis CXIdxEntity_Union = 15, 51102957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 51112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXClass = 16, 51122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespace = 17, 51132957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXNamespaceAlias = 18, 51142957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticVariable = 19, 51152957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXStaticMethod = 20, 51162957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_CXXInstanceMethod = 21, 511717d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXConstructor = 22, 511817d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXDestructor = 23, 511917d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXConversionFunction = 24, 512017d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXTypeAlias = 25, 512117d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos CXIdxEntity_CXXInterface = 26 512217d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos 512317d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos} CXIdxEntityKind; 512417d35c36fbae764fcd68fa8b31624078a033aabcJoao Matos 5125838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidistypedef enum { 5126838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_None = 0, 5127838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_C = 1, 5128838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_ObjC = 2, 5129838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis CXIdxEntityLang_CXX = 3 5130838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis} CXIdxEntityLanguage; 5131838d3c23204f52ae27a9f5e9a254238a7ac5d41bArgyrios Kyrtzidis 51322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 51332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Extra C++ template information for an entity. This can apply to: 51342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_Function 51352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXClass 51362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXStaticMethod 51372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXInstanceMethod 51382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConstructor 51392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXConversionFunction 51402957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * CXIdxEntity_CXXTypeAlias 51412957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 51422957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef enum { 51432957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_NonTemplate = 0, 51442957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_Template = 1, 51452957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplatePartialSpecialization = 2, 51462957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXIdxEntity_TemplateSpecialization = 3 51472957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxEntityCXXTemplateKind; 51482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 5149b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef enum { 5150b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_Unexposed = 0, 5151b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBAction = 1, 5152b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutlet = 2, 5153b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttr_IBOutletCollection = 3 5154b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrKind; 5155b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5156b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 5157b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxAttrKind kind; 5158b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor cursor; 5159b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc loc; 5160b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxAttrInfo; 5161b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5162b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidistypedef struct { 5163643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityKind kind; 5164643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityCXXTemplateKind templateKind; 5165643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXIdxEntityLanguage lang; 5166643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *name; 5167643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const char *USR; 5168643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 5169643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 5170643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis unsigned numAttributes; 5171643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxEntityInfo; 5172643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 5173643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 5174643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis CXCursor cursor; 5175643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis} CXIdxContainerInfo; 5176643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidis 5177643d3ce93c501d19353f2fa578fee3e97f1d1b4bArgyrios Kyrtzidistypedef struct { 5178b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *attrInfo; 5179b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 5180b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXCursor classCursor; 5181b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxLoc classLoc; 5182b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis} CXIdxIBOutletCollectionAttrInfo; 5183b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 5184838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidistypedef enum { 5185838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIdxDeclFlag_Skipped = 0x1 5186838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis} CXIdxDeclInfoFlags; 5187838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 51884e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 51896ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *entityInfo; 5190dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXCursor cursor; 5191dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxLoc loc; 5192b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *semanticContainer; 5193b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis /** 51947eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Generally same as #semanticContainer but can be different in 5195b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis * cases like out-of-line C++ member functions. 5196b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis */ 5197b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis const CXIdxContainerInfo *lexicalContainer; 5198dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis int isRedeclaration; 51994e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int isDefinition; 5200c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isContainer; 52012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *declAsContainer; 5202c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis /** 5203c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis * \brief Whether the declaration exists in code or was created implicitly 5204c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis * by the compiler, e.g. implicit objc methods for properties. 5205c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis */ 5206c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis int isImplicit; 5207b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis const CXIdxAttrInfo *const *attributes; 5208b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis unsigned numAttributes; 5209838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5210838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis unsigned flags; 5211838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5212dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxDeclInfo; 52134e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5214dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidistypedef enum { 5215dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_ForwardRef = 0, 5216dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Interface = 1, 5217dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainer_Implementation = 2 5218dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerKind; 52194e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52204e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 52216ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 5222dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxObjCContainerKind kind; 5223dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis} CXIdxObjCContainerDeclInfo; 52244e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52254e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 52266ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *base; 52276ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 52284e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 52296ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis} CXIdxBaseClassInfo; 52304e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 52326ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *protocol; 52336ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis CXCursor cursor; 52344e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 52354e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxObjCProtocolRefInfo; 52364e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52374e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 52386ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxObjCProtocolRefInfo *const *protocols; 52394e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned numProtocols; 5240c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCProtocolRefListInfo; 52414e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52424e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5243c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 5244c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxBaseClassInfo *superInfo; 5245c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 5246c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidis} CXIdxObjCInterfaceDeclInfo; 52474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 52482957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef struct { 5249c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCContainerDeclInfo *containerInfo; 5250c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxEntityInfo *objcClass; 5251c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXCursor classCursor; 5252c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis CXIdxLoc classLoc; 5253c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis const CXIdxObjCProtocolRefListInfo *protocols; 5254c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis} CXIdxObjCCategoryDeclInfo; 5255c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidis 5256c10a4c8baff3164bee9b7fc293679a5a5a90eb74Argyrios Kyrtzidistypedef struct { 52572957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 5258792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *getter; 5259792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxEntityInfo *setter; 5260792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis} CXIdxObjCPropertyDeclInfo; 5261792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 5262792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidistypedef struct { 5263792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis const CXIdxDeclInfo *declInfo; 52642957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxBaseClassInfo *const *bases; 52652957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned numBases; 52662957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis} CXIdxCXXClassDeclInfo; 52672957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 5268bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 52697eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference. 5270bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5271aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidistypedef enum { 5272bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5273bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity is referenced directly in user's code. 5274bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5275aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis CXIdxEntityRef_Direct = 1, 5276bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5277b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * \brief An implicit reference, e.g. a reference of an ObjC method via the 5278b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * dot syntax. 5279bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5280b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXIdxEntityRef_Implicit = 2 5281aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis} CXIdxEntityRefKind; 5282aca19be8731fc31cff68702de0dc7f30ce908979Argyrios Kyrtzidis 5283bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 52847eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Data for IndexerCallbacks#indexEntityReference. 5285bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52864e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5287b1febb646bf7a2f319ad894c9833968c52d21711Argyrios Kyrtzidis CXIdxEntityRefKind kind; 5288bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5289bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Reference cursor. 5290bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52914e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXCursor cursor; 52924e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXIdxLoc loc; 5293bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5294bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief The entity that gets referenced. 5295bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 52966ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *referencedEntity; 5297bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5298bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Immediate "parent" of the reference. For example: 5299bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5300bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \code 5301bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * Foo *var; 5302bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \endcode 5303bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5304bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * The parent of reference of type 'Foo' is the variable 'var'. 5305e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * For references inside statement bodies of functions/methods, 5306e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * the parentEntity will be the function/method. 5307bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 53086ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityInfo *parentEntity; 5309bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5310e422e45a6a89d450b8eca10f671b49874e87617aArgyrios Kyrtzidis * \brief Lexical container context of the reference. 5311bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 53122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxContainerInfo *container; 53134e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} CXIdxEntityRefInfo; 53144e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 53157eee0184570366285589d788bcd7f5dda8345915James Dennett/** 53167eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief A group of callbacks used by #clang_indexSourceFile and 53177eee0184570366285589d788bcd7f5dda8345915James Dennett * #clang_indexTranslationUnit. 53187eee0184570366285589d788bcd7f5dda8345915James Dennett */ 53194e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidistypedef struct { 5320bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 53216ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * \brief Called periodically to check whether indexing should be aborted. 53226ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis * Should return 0 to continue, and non-zero to abort. 53236ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis */ 53246ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis int (*abortQuery)(CXClientData client_data, void *reserved); 53256ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 53266ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis /** 5327b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis * \brief Called at the end of indexing; passes the complete diagnostic set. 5328bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 53294e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*diagnostic)(CXClientData client_data, 5330b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis CXDiagnosticSet, void *reserved); 53314e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5332dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*enteredMainFile)(CXClientData client_data, 53337eee0184570366285589d788bcd7f5dda8345915James Dennett CXFile mainFile, void *reserved); 5334dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5335bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 53367eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Called when a file gets \#included/\#imported. 5337bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5338dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile (*ppIncludedFile)(CXClientData client_data, 53396ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxIncludedFileInfo *); 53404e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5341bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5342bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called when a AST file (PCH or module) gets imported. 5343bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5344bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * AST files will not get indexed (there will not be callbacks to index all 5345bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the entities in an AST file). The recommended action is that, if the AST 53462c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * file is not already indexed, to initiate a new indexing job specific to 53472c3e05c266de0d4c465b58ffd129bd0b31604368Argyrios Kyrtzidis * the AST file. 5348bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5349dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientASTFile (*importedASTFile)(CXClientData client_data, 53506ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxImportedASTFileInfo *); 53514e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5352bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5353bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called at the beginning of indexing a translation unit. 5354bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 5355dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientContainer (*startedTranslationUnit)(CXClientData client_data, 53566ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void *reserved); 53574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 53586ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis void (*indexDeclaration)(CXClientData client_data, 53592957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis const CXIdxDeclInfo *); 53604e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5361bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis /** 5362bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Called to index a reference of an entity. 5363bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 53644e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis void (*indexEntityReference)(CXClientData client_data, 53656ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis const CXIdxEntityRefInfo *); 53664e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 53674e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis} IndexerCallbacks; 53684e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5369ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE int clang_index_isEntityObjCContainerKind(CXIdxEntityKind); 53706ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCContainerDeclInfo * 53716ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCContainerDeclInfo(const CXIdxDeclInfo *); 53726ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 53736ec43adc39006a7fce94188956d0239bd54c0363Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCInterfaceDeclInfo * 53746ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCInterfaceDeclInfo(const CXIdxDeclInfo *); 5375dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5376ab336c1adca7f6920fd886c132f199e469b63fb5NAKAMURA TakumiCINDEX_LINKAGE 53776ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisconst CXIdxObjCCategoryDeclInfo * 53786ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidisclang_index_getObjCCategoryDeclInfo(const CXIdxDeclInfo *); 53796ec43adc39006a7fce94188956d0239bd54c0363Argyrios Kyrtzidis 5380c71d55469e7d5f7b376a30620617a175a9442da9Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCProtocolRefListInfo * 5381c71d55469e7d5f7b376a30620617a175a9442da9Argyrios Kyrtzidisclang_index_getObjCProtocolRefListInfo(const CXIdxDeclInfo *); 5382dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis 5383792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios KyrtzidisCINDEX_LINKAGE const CXIdxObjCPropertyDeclInfo * 5384792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidisclang_index_getObjCPropertyDeclInfo(const CXIdxDeclInfo *); 5385792db266f3d2f12a7a16bf37d90074f54bca1e6fArgyrios Kyrtzidis 5386b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxIBOutletCollectionAttrInfo * 5387b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidisclang_index_getIBOutletCollectionAttrInfo(const CXIdxAttrInfo *); 5388b395c63b473bf1b3783bff371a993332e8c4c5e3Argyrios Kyrtzidis 53892957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE const CXIdxCXXClassDeclInfo * 53902957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getCXXClassDeclInfo(const CXIdxDeclInfo *); 53912957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53922957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 53932957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientContainer attached to a 53942957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 53952957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 53962957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientContainer 53972957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientContainer(const CXIdxContainerInfo *); 53982957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 53992957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 54002957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientContainer attached to a 54012957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * container. 54022957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 54042957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientContainer(const CXIdxContainerInfo *,CXIdxClientContainer); 54052957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 54062957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 54072957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For retrieving a custom CXIdxClientEntity attached to an entity. 54082957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54092957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIdxClientEntity 54102957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_getClientEntity(const CXIdxEntityInfo *); 54112957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 54122957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 54132957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief For setting a custom CXIdxClientEntity attached to an entity. 54142957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54152957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void 54162957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidisclang_index_setClientEntity(const CXIdxEntityInfo *, CXIdxClientEntity); 54172957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 54182957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 5419838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple 5420838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units. 54212957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54222957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidistypedef void *CXIndexAction; 54232957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 54242957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 5425838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief An indexing action/session, to be applied to one or multiple 5426838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * translation units. 54272957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 54282957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \param CIdx The index object with which the index action will be associated. 54292957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54302957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE CXIndexAction clang_IndexAction_create(CXIndex CIdx); 54312957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 54322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis/** 54332957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * \brief Destroy the given index action. 54342957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * 54352957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * The index action must not be destroyed until all of the translation units 54362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis * created within that index action have been destroyed. 54372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis */ 54382957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE void clang_IndexAction_dispose(CXIndexAction); 54392957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis 544021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidistypedef enum { 544121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 544221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Used to indicate that no special indexing options are needed. 544321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 544421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXIndexOpt_None = 0x0, 544521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 544621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis /** 54477eee0184570366285589d788bcd7f5dda8345915James Dennett * \brief Used to indicate that IndexerCallbacks#indexEntityReference should 54487eee0184570366285589d788bcd7f5dda8345915James Dennett * be invoked for only one reference of an entity per source file that does 54497eee0184570366285589d788bcd7f5dda8345915James Dennett * not also include a declaration/definition of the entity. 545021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 545122490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis CXIndexOpt_SuppressRedundantRefs = 0x1, 545222490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis 545322490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis /** 545422490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * \brief Function-local symbols should be indexed. If this is not set 545522490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis * function-local symbols will be ignored. 545622490747c123a78feec089539f30426084d348cfArgyrios Kyrtzidis */ 545758d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis CXIndexOpt_IndexFunctionLocalSymbols = 0x2, 545858d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis 545958d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis /** 546058d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * \brief Implicit function/class template instantiations should be indexed. 546158d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis * If this is not set, implicit instantiations will be ignored. 546258d2dbea680a75de266c5eff77cc15c323cfd48aArgyrios Kyrtzidis */ 5463b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis CXIndexOpt_IndexImplicitTemplateInstantiations = 0x4, 5464b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis 5465b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis /** 5466b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis * \brief Suppress all compiler warnings when parsing for indexing. 5467b49a29f7e4413a7a014a2b28c5c25fe54e005cf3Argyrios Kyrtzidis */ 5468838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIndexOpt_SuppressWarnings = 0x8, 5469838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 5470838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis /** 5471838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * \brief Skip a function/method body that was already parsed during an 5472838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * indexing session assosiated with a \c CXIndexAction object. 5473838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis * Bodies in system headers are always skipped. 5474838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis */ 5475838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis CXIndexOpt_SkipParsedBodiesInSession = 0x10 5476838eb7e8652e451d93494a4e583e4d11809bcb4aArgyrios Kyrtzidis 547721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis} CXIndexOptFlags; 547821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 5479bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5480bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Index the given source file and the translation unit corresponding 54817eee0184570366285589d788bcd7f5dda8345915James Dennett * to that file via callbacks implemented through #IndexerCallbacks. 5482bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5483bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param client_data pointer data supplied by the client, which will 5484bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * be passed to the invoked callbacks. 5485bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5486bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param index_callbacks Pointer to indexing callbacks that the client 5487bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * implements. 5488bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 54897eee0184570366285589d788bcd7f5dda8345915James Dennett * \param index_callbacks_size Size of #IndexerCallbacks structure that gets 5490bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * passed in index_callbacks. 5491bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 549221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \param index_options A bitmask of options that affects how indexing is 549321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * performed. This should be a bitwise OR of the CXIndexOpt_XXX flags. 5494bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5495bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \param out_TU [out] pointer to store a CXTranslationUnit that can be reused 5496bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * after indexing is finished. Set to NULL if you do not require it. 5497bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 549821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns 5499bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * non-zero, otherwise returns 0. 550021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 55017eee0184570366285589d788bcd7f5dda8345915James Dennett * The rest of the parameters are the same as #clang_parseTranslationUnit. 5502bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 55032957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexSourceFile(CXIndexAction, 55044e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXClientData client_data, 55054e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis IndexerCallbacks *index_callbacks, 55064e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_callbacks_size, 55074e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned index_options, 55084e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char *source_filename, 55094e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis const char * const *command_line_args, 55104e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis int num_command_line_args, 55114e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis struct CXUnsavedFile *unsaved_files, 55124e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned num_unsaved_files, 55134e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXTranslationUnit *out_TU, 55144e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned TU_options); 55154e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5516bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 551721ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \brief Index the given translation unit via callbacks implemented through 55187eee0184570366285589d788bcd7f5dda8345915James Dennett * #IndexerCallbacks. 551921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 552021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * The order of callback invocations is not guaranteed to be the same as 552121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * when indexing a source file. The high level order will be: 552221ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 552321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Preprocessor callbacks invocations 552421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Declaration/reference callbacks invocations 552521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * -Diagnostic callback invocations 552621ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 55277eee0184570366285589d788bcd7f5dda8345915James Dennett * The parameters are the same as #clang_indexSourceFile. 552821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * 552921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * \returns If there is a failure from which the there is no recovery, returns 553021ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis * non-zero, otherwise returns 0. 553121ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis */ 55322957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios KyrtzidisCINDEX_LINKAGE int clang_indexTranslationUnit(CXIndexAction, 553321ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis CXClientData client_data, 553421ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis IndexerCallbacks *index_callbacks, 553521ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis unsigned index_callbacks_size, 55362957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis unsigned index_options, 55372957e6f8c4c2e58a4b9cb639949fea801970fe36Argyrios Kyrtzidis CXTranslationUnit); 553821ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis 553921ee5707e6e59d982d2f2ae28e079c7ff46dc519Argyrios Kyrtzidis/** 5540bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXIdxFile, file, line, column, and offset represented by 5541bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * the given CXIdxLoc. 5542bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * 5543bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * If the location refers into a macro expansion, retrieves the 5544bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * location of the macro expansion and if it refers into a macro argument 5545bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * retrieves the location of the argument. 5546bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 55474e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE void clang_indexLoc_getFileLocation(CXIdxLoc loc, 5548dd93c596cd95e1b96031ff47efe0a5095ff3d7f1Argyrios Kyrtzidis CXIdxClientFile *indexFile, 55494e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis CXFile *file, 55504e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *line, 55514e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *column, 55524e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis unsigned *offset); 55534e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5554bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis/** 5555bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis * \brief Retrieve the CXSourceLocation represented by the given CXIdxLoc. 5556bd0ddf88415441d3b5741a7bd40a3d56adcd4d66Argyrios Kyrtzidis */ 55574e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCINDEX_LINKAGE 55584e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios KyrtzidisCXSourceLocation clang_indexLoc_getCXSourceLocation(CXIdxLoc loc); 55594e7064fa7e344e8f87a5b8457e96dfdd252c4a9eArgyrios Kyrtzidis 5560aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis/** 5561aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis * @} 5562aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis */ 5563aed123ec3cc37e457fe20a6158fdadf8849ad916Argyrios Kyrtzidis 5564c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor/** 5565c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor * @} 5566c42fefa51f7555bb3644a7cde2ca4bfd0d848d74Douglas Gregor */ 55671efcf3d137c11fb6b21c385911e0d2ca59ca94c3Daniel Dunbar 5568d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus 5569d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek} 5570d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 5571d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif 5572d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek 5573