Ted Kremenek | d2fa566 | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 1 | /*===-- clang-c/Index.h - Indexing Public C Interface -------------*- C -*-===*\ |
| 2 | |* *| |
| 3 | |* The LLVM Compiler Infrastructure *| |
| 4 | |* *| |
| 5 | |* This file is distributed under the University of Illinois Open Source *| |
| 6 | |* License. See LICENSE.TXT for details. *| |
| 7 | |* *| |
| 8 | |*===----------------------------------------------------------------------===*| |
| 9 | |* *| |
| 10 | |* This header provides a public inferface to a Clang library for extracting *| |
| 11 | |* high-level symbol information from source files without exposing the full *| |
| 12 | |* Clang C++ API. *| |
| 13 | |* *| |
| 14 | \*===----------------------------------------------------------------------===*/ |
| 15 | |
| 16 | #ifndef CLANG_C_INDEX_H |
| 17 | #define CLANG_C_INDEX_H |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 23 | // MSVC DLL import/export. |
| 24 | #ifdef _MSC_VER |
| 25 | #ifdef _CINDEX_LIB_ |
| 26 | #define CINDEX_LINKAGE __declspec(dllexport) |
| 27 | #else |
| 28 | #define CINDEX_LINKAGE __declspec(dllimport) |
| 29 | #endif |
| 30 | #else |
| 31 | #define CINDEX_LINKAGE |
| 32 | #endif |
| 33 | |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 34 | /* |
| 35 | Clang indeX abstractions. The backing store for the following API's will be |
Steve Naroff | b7cd17c | 2009-09-01 17:13:31 +0000 | [diff] [blame] | 36 | clangs AST file (currently based on PCH). AST files are created as follows: |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 37 | |
Steve Naroff | b7cd17c | 2009-09-01 17:13:31 +0000 | [diff] [blame] | 38 | "clang -emit-ast <sourcefile.langsuffix> -o <sourcefile.ast>". |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 39 | |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 40 | Naming Conventions: To avoid namespace pollution, data types are prefixed |
| 41 | with "CX" and functions are prefixed with "clang_". |
| 42 | */ |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 43 | typedef void *CXIndex; /* An indexing instance. */ |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 44 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 45 | typedef void *CXTranslationUnit; /* A translation unit instance. */ |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 46 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 47 | typedef void *CXDecl; /* A specific declaration within a translation unit. */ |
Steve Naroff | fb57042 | 2009-09-22 19:25:29 +0000 | [diff] [blame] | 48 | typedef void *CXStmt; /* A specific statement within a function/method */ |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 49 | |
Steve Naroff | c857ea4 | 2009-09-02 13:28:54 +0000 | [diff] [blame] | 50 | /* Cursors represent declarations, definitions, and references. */ |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 51 | enum CXCursorKind { |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 52 | /* Declarations */ |
| 53 | CXCursor_FirstDecl = 1, |
Steve Naroff | c857ea4 | 2009-09-02 13:28:54 +0000 | [diff] [blame] | 54 | CXCursor_TypedefDecl = 2, |
| 55 | CXCursor_StructDecl = 3, |
| 56 | CXCursor_UnionDecl = 4, |
| 57 | CXCursor_ClassDecl = 5, |
| 58 | CXCursor_EnumDecl = 6, |
| 59 | CXCursor_FieldDecl = 7, |
| 60 | CXCursor_EnumConstantDecl = 8, |
| 61 | CXCursor_FunctionDecl = 9, |
| 62 | CXCursor_VarDecl = 10, |
| 63 | CXCursor_ParmDecl = 11, |
| 64 | CXCursor_ObjCInterfaceDecl = 12, |
| 65 | CXCursor_ObjCCategoryDecl = 13, |
| 66 | CXCursor_ObjCProtocolDecl = 14, |
| 67 | CXCursor_ObjCPropertyDecl = 15, |
| 68 | CXCursor_ObjCIvarDecl = 16, |
| 69 | CXCursor_ObjCInstanceMethodDecl = 17, |
| 70 | CXCursor_ObjCClassMethodDecl = 18, |
| 71 | CXCursor_LastDecl = 18, |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 72 | |
Steve Naroff | c857ea4 | 2009-09-02 13:28:54 +0000 | [diff] [blame] | 73 | /* Definitions */ |
| 74 | CXCursor_FirstDefn = 32, |
| 75 | CXCursor_FunctionDefn = 32, |
| 76 | CXCursor_ObjCClassDefn = 33, |
| 77 | CXCursor_ObjCCategoryDefn = 34, |
| 78 | CXCursor_ObjCInstanceMethodDefn = 35, |
| 79 | CXCursor_ObjCClassMethodDefn = 36, |
| 80 | CXCursor_LastDefn = 36, |
| 81 | |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 82 | /* References */ |
Steve Naroff | fb57042 | 2009-09-22 19:25:29 +0000 | [diff] [blame] | 83 | CXCursor_FirstRef = 40, /* Decl references */ |
Steve Naroff | f334b4e | 2009-09-02 18:26:48 +0000 | [diff] [blame] | 84 | CXCursor_ObjCSuperClassRef = 40, |
| 85 | CXCursor_ObjCProtocolRef = 41, |
Steve Naroff | fb57042 | 2009-09-22 19:25:29 +0000 | [diff] [blame] | 86 | CXCursor_ObjCClassRef = 42, |
| 87 | |
| 88 | CXCursor_ObjCSelectorRef = 43, /* Expression references */ |
| 89 | CXCursor_ObjCIvarRef = 44, |
| 90 | CXCursor_VarRef = 45, |
| 91 | CXCursor_FunctionRef = 46, |
| 92 | CXCursor_EnumConstantRef = 47, |
| 93 | CXCursor_MemberRef = 48, |
| 94 | CXCursor_LastRef = 48, |
Steve Naroff | 77128dd | 2009-09-15 20:25:34 +0000 | [diff] [blame] | 95 | |
| 96 | /* Error conditions */ |
| 97 | CXCursor_FirstInvalid = 70, |
| 98 | CXCursor_InvalidFile = 70, |
| 99 | CXCursor_NoDeclFound = 71, |
| 100 | CXCursor_NotImplemented = 72, |
| 101 | CXCursor_LastInvalid = 72 |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 102 | }; |
| 103 | |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 104 | /* A cursor into the CXTranslationUnit. */ |
Steve Naroff | fb57042 | 2009-09-22 19:25:29 +0000 | [diff] [blame] | 105 | |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 106 | typedef struct { |
| 107 | enum CXCursorKind kind; |
| 108 | CXDecl decl; |
Steve Naroff | fb57042 | 2009-09-22 19:25:29 +0000 | [diff] [blame] | 109 | CXStmt stmt; /* expression reference */ |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 110 | } CXCursor; |
| 111 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 112 | /* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */ |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 113 | typedef void *CXEntity; |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 114 | |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 115 | /** |
| 116 | * \brief clang_createIndex() provides a shared context for creating |
| 117 | * translation units. It provides two options: |
| 118 | * |
| 119 | * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local" |
| 120 | * declarations (when loading any new translation units). A "local" declaration |
| 121 | * is one that belongs in the translation unit itself and not in a precompiled |
| 122 | * header that was used by the translation unit. If zero, all declarations |
| 123 | * will be enumerated. |
| 124 | * |
| 125 | * - displayDiagnostics: when non-zero, diagnostics will be output. If zero, |
| 126 | * diagnostics will be ignored. |
Steve Naroff | b4ece63 | 2009-10-20 16:36:34 +0000 | [diff] [blame] | 127 | * |
| 128 | * Here is an example: |
| 129 | * |
| 130 | * // excludeDeclsFromPCH = 1, displayDiagnostics = 1 |
| 131 | * Idx = clang_createIndex(1, 1); |
| 132 | * |
| 133 | * // IndexTest.pch was produced with the following command: |
| 134 | * // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch" |
| 135 | * TU = clang_createTranslationUnit(Idx, "IndexTest.pch"); |
| 136 | * |
| 137 | * // This will load all the symbols from 'IndexTest.pch' |
| 138 | * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0); |
| 139 | * clang_disposeTranslationUnit(TU); |
| 140 | * |
| 141 | * // This will load all the symbols from 'IndexTest.c', excluding symbols |
| 142 | * // from 'IndexTest.pch'. |
| 143 | * char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 }; |
| 144 | * TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args); |
| 145 | * clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0); |
| 146 | * clang_disposeTranslationUnit(TU); |
| 147 | * |
| 148 | * This process of creating the 'pch', loading it separately, and using it (via |
| 149 | * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks |
| 150 | * (which gives the indexer the same performance benefit as the compiler). |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 151 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 152 | CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH, |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 153 | int displayDiagnostics); |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 154 | CINDEX_LINKAGE void clang_disposeIndex(CXIndex); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 155 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 156 | CINDEX_LINKAGE const char *clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit); |
Steve Naroff | af08ddc | 2009-09-03 15:49:00 +0000 | [diff] [blame] | 157 | |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 158 | /* |
| 159 | * \brief Create a translation unit from an AST file (-emit-ast). |
| 160 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 161 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit( |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 162 | CXIndex, const char *ast_filename |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 163 | ); |
Ted Kremenek | 1374598 | 2009-10-19 22:15:09 +0000 | [diff] [blame] | 164 | /** |
| 165 | * \brief Destroy the specified CXTranslationUnit object. |
| 166 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 167 | CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit); |
Ted Kremenek | 1374598 | 2009-10-19 22:15:09 +0000 | [diff] [blame] | 168 | |
| 169 | /** |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 170 | * \brief Return the CXTranslationUnit for a given source file and the provided |
| 171 | * command line arguments one would pass to the compiler. |
| 172 | * |
Ted Kremenek | 139ba86 | 2009-10-22 00:03:57 +0000 | [diff] [blame] | 173 | * Note: The 'source_filename' argument is optional. If the caller provides a NULL pointer, |
| 174 | * the name of the source file is expected to reside in the specified command line arguments. |
| 175 | * |
| 176 | * Note: When encountered in 'clang_command_line_args', the following options are ignored: |
| 177 | * |
| 178 | * '-c' |
| 179 | * '-emit-ast' |
| 180 | * '-fsyntax-only' |
| 181 | * '-o <output file>' (both '-o' and '<output file>' are ignored) |
| 182 | * |
Ted Kremenek | 1374598 | 2009-10-19 22:15:09 +0000 | [diff] [blame] | 183 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 184 | CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile( |
Steve Naroff | 5b7d8e2 | 2009-10-15 20:04:39 +0000 | [diff] [blame] | 185 | CXIndex CIdx, |
Ted Kremenek | 139ba86 | 2009-10-22 00:03:57 +0000 | [diff] [blame] | 186 | const char *source_filename /* specify NULL if the source file is in clang_command_line_args */, |
Steve Naroff | 5b7d8e2 | 2009-10-15 20:04:39 +0000 | [diff] [blame] | 187 | int num_clang_command_line_args, |
Steve Naroff | e56b4ba | 2009-10-20 14:46:24 +0000 | [diff] [blame] | 188 | const char **clang_command_line_args |
Steve Naroff | 5b7d8e2 | 2009-10-15 20:04:39 +0000 | [diff] [blame] | 189 | ); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 190 | |
| 191 | /* |
| 192 | Usage: clang_loadTranslationUnit(). Will load the toplevel declarations |
| 193 | within a translation unit, issuing a 'callback' for each one. |
| 194 | |
| 195 | void printObjCInterfaceNames(CXTranslationUnit X, CXCursor C) { |
| 196 | if (clang_getCursorKind(C) == Cursor_Declaration) { |
| 197 | CXDecl D = clang_getCursorDecl(C); |
| 198 | if (clang_getDeclKind(D) == CXDecl_ObjC_interface) |
| 199 | printf("@interface %s in file %s on line %d column %d\n", |
| 200 | clang_getDeclSpelling(D), clang_getCursorSource(C), |
| 201 | clang_getCursorLine(C), clang_getCursorColumn(C)); |
| 202 | } |
| 203 | } |
| 204 | static void usage { |
| 205 | clang_loadTranslationUnit(CXTranslationUnit, printObjCInterfaceNames); |
| 206 | } |
| 207 | */ |
Steve Naroff | 2b8ee6c | 2009-09-01 15:55:40 +0000 | [diff] [blame] | 208 | typedef void *CXClientData; |
| 209 | typedef void (*CXTranslationUnitIterator)(CXTranslationUnit, CXCursor, |
| 210 | CXClientData); |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 211 | CINDEX_LINKAGE void clang_loadTranslationUnit(CXTranslationUnit, CXTranslationUnitIterator, |
Steve Naroff | 2b8ee6c | 2009-09-01 15:55:40 +0000 | [diff] [blame] | 212 | CXClientData); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 213 | |
| 214 | /* |
| 215 | Usage: clang_loadDeclaration(). Will load the declaration, issuing a |
| 216 | 'callback' for each declaration/reference within the respective declaration. |
| 217 | |
| 218 | For interface declarations, this will index the super class, protocols, |
| 219 | ivars, methods, etc. For structure declarations, this will index the fields. |
| 220 | For functions, this will index the parameters (and body, for function |
| 221 | definitions), local declarations/references. |
| 222 | |
| 223 | void getInterfaceDetails(CXDecl X, CXCursor C) { |
| 224 | switch (clang_getCursorKind(C)) { |
| 225 | case Cursor_ObjC_ClassRef: |
| 226 | CXDecl SuperClass = clang_getCursorDecl(C); |
| 227 | case Cursor_ObjC_ProtocolRef: |
| 228 | CXDecl AdoptsProtocol = clang_getCursorDecl(C); |
| 229 | case Cursor_Declaration: |
| 230 | CXDecl AnIvarOrMethod = clang_getCursorDecl(C); |
| 231 | } |
| 232 | } |
| 233 | static void usage() { |
| 234 | if (clang_getDeclKind(D) == CXDecl_ObjC_interface) { |
| 235 | clang_loadDeclaration(D, getInterfaceDetails); |
| 236 | } |
| 237 | } |
| 238 | */ |
Steve Naroff | c857ea4 | 2009-09-02 13:28:54 +0000 | [diff] [blame] | 239 | typedef void (*CXDeclIterator)(CXDecl, CXCursor, CXClientData); |
Steve Naroff | 89922f8 | 2009-08-31 00:59:03 +0000 | [diff] [blame] | 240 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 241 | CINDEX_LINKAGE void clang_loadDeclaration(CXDecl, CXDeclIterator, CXClientData); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 242 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 243 | /* |
| 244 | * CXEntity Operations. |
| 245 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 246 | CINDEX_LINKAGE const char *clang_getDeclarationName(CXEntity); |
| 247 | CINDEX_LINKAGE const char *clang_getURI(CXEntity); |
| 248 | CINDEX_LINKAGE CXEntity clang_getEntity(const char *URI); |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 249 | /* |
| 250 | * CXDecl Operations. |
| 251 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 252 | CINDEX_LINKAGE CXCursor clang_getCursorFromDecl(CXDecl); |
| 253 | CINDEX_LINKAGE CXEntity clang_getEntityFromDecl(CXDecl); |
| 254 | CINDEX_LINKAGE const char *clang_getDeclSpelling(CXDecl); |
| 255 | CINDEX_LINKAGE unsigned clang_getDeclLine(CXDecl); |
| 256 | CINDEX_LINKAGE unsigned clang_getDeclColumn(CXDecl); |
| 257 | CINDEX_LINKAGE const char *clang_getDeclSource(CXDecl); |
Steve Naroff | 699a07d | 2009-09-25 21:32:34 +0000 | [diff] [blame] | 258 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 259 | /* |
| 260 | * CXCursor Operations. |
| 261 | */ |
Steve Naroff | 6a6de8b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 262 | /** |
| 263 | Usage: clang_getCursor() will translate a source/line/column position |
| 264 | into an AST cursor (to derive semantic information from the source code). |
Steve Naroff | 6a6de8b | 2009-10-21 13:56:23 +0000 | [diff] [blame] | 265 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 266 | CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, const char *source_name, |
Ted Kremenek | fbcb2b7 | 2009-10-22 17:22:53 +0000 | [diff] [blame] | 267 | unsigned line, unsigned column); |
| 268 | |
| 269 | /** |
| 270 | Usage: clang_getCursorWithHint() provides the same functionality as |
| 271 | clang_getCursor() except that it takes an option 'hint' argument. |
| 272 | The 'hint' is a temporary CXLookupHint object (whose lifetime is managed by |
| 273 | the caller) that should be initialized with clang_initCXLookupHint(). |
| 274 | |
| 275 | FIXME: Add a better comment once getCursorWithHint() has more functionality. |
| 276 | */ |
| 277 | typedef CXCursor CXLookupHint; |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 278 | CINDEX_LINKAGE CXCursor clang_getCursorWithHint(CXTranslationUnit, const char *source_name, |
Ted Kremenek | fbcb2b7 | 2009-10-22 17:22:53 +0000 | [diff] [blame] | 279 | unsigned line, unsigned column, |
| 280 | CXLookupHint *hint); |
| 281 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 282 | CINDEX_LINKAGE void clang_initCXLookupHint(CXLookupHint *hint); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 283 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 284 | CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor); |
| 285 | CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind); |
| 286 | CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind); |
| 287 | CINDEX_LINKAGE unsigned clang_isDefinition(enum CXCursorKind); |
| 288 | CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 289 | |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 290 | CINDEX_LINKAGE unsigned clang_getCursorLine(CXCursor); |
| 291 | CINDEX_LINKAGE unsigned clang_getCursorColumn(CXCursor); |
| 292 | CINDEX_LINKAGE const char *clang_getCursorSource(CXCursor); |
| 293 | CINDEX_LINKAGE const char *clang_getCursorSpelling(CXCursor); |
Steve Naroff | f334b4e | 2009-09-02 18:26:48 +0000 | [diff] [blame] | 294 | |
Steve Naroff | 4ade6d6 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 295 | /* for debug/testing */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 296 | CINDEX_LINKAGE const char *clang_getCursorKindSpelling(enum CXCursorKind Kind); |
| 297 | CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor, |
Steve Naroff | 4ade6d6 | 2009-09-23 17:52:52 +0000 | [diff] [blame] | 298 | const char **startBuf, |
| 299 | const char **endBuf, |
| 300 | unsigned *startLine, |
| 301 | unsigned *startColumn, |
| 302 | unsigned *endLine, |
| 303 | unsigned *endColumn); |
Steve Naroff | 600866c | 2009-08-27 19:51:58 +0000 | [diff] [blame] | 304 | |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 305 | /* |
Chris Lattner | 459789b | 2009-09-16 20:18:54 +0000 | [diff] [blame] | 306 | * If CXCursorKind == Cursor_Reference, then this will return the referenced |
| 307 | * declaration. |
Steve Naroff | 5039819 | 2009-08-28 15:28:48 +0000 | [diff] [blame] | 308 | * If CXCursorKind == Cursor_Declaration, then this will return the declaration. |
| 309 | */ |
John Thompson | 2e06fc8 | 2009-10-27 13:42:56 +0000 | [diff] [blame^] | 310 | CINDEX_LINKAGE CXDecl clang_getCursorDecl(CXCursor); |
Ted Kremenek | d2fa566 | 2009-08-26 22:36:44 +0000 | [diff] [blame] | 311 | |
| 312 | #ifdef __cplusplus |
| 313 | } |
| 314 | #endif |
| 315 | #endif |
| 316 | |