Index.h revision e56b4baeba5097852e04bc41ca2e0396cf729955
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
19d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
20d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenekextern "C" {
21d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
22d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
23600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff/*
24600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   Clang indeX abstractions. The backing store for the following API's will be
25b7cd17cfd2970636af0fe9b491bab1acf0009c2fSteve Naroff   clangs AST file (currently based on PCH). AST files are created as follows:
26600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
27b7cd17cfd2970636af0fe9b491bab1acf0009c2fSteve Naroff   "clang -emit-ast <sourcefile.langsuffix> -o <sourcefile.ast>".
28600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
29600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   Naming Conventions: To avoid namespace pollution, data types are prefixed
30600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   with "CX" and functions are prefixed with "clang_".
31600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff*/
3250398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Narofftypedef void *CXIndex;            /* An indexing instance. */
33600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
3450398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Narofftypedef void *CXTranslationUnit;  /* A translation unit instance. */
35600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
3689922f86f4e7da383af2a62ef04ad8b93b941220Steve Narofftypedef void *CXDecl;    /* A specific declaration within a translation unit. */
37fb5704295c6137685a7b90b92cd6b958028740c8Steve Narofftypedef void *CXStmt;    /* A specific statement within a function/method */
38600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
39c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff/* Cursors represent declarations, definitions, and references. */
4089922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroffenum CXCursorKind {
4189922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff /* Declarations */
4289922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff CXCursor_FirstDecl                     = 1,
43c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_TypedefDecl                   = 2,
44c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_StructDecl                    = 3,
45c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_UnionDecl                     = 4,
46c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ClassDecl                     = 5,
47c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_EnumDecl                      = 6,
48c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_FieldDecl                     = 7,
49c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_EnumConstantDecl              = 8,
50c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_FunctionDecl                  = 9,
51c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_VarDecl                       = 10,
52c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ParmDecl                      = 11,
53c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCInterfaceDecl             = 12,
54c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCCategoryDecl              = 13,
55c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCProtocolDecl              = 14,
56c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCPropertyDecl              = 15,
57c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCIvarDecl                  = 16,
58c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCInstanceMethodDecl        = 17,
59c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCClassMethodDecl           = 18,
60c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_LastDecl                      = 18,
6189922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff
62c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff /* Definitions */
63c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_FirstDefn                     = 32,
64c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_FunctionDefn                  = 32,
65c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCClassDefn                 = 33,
66c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCCategoryDefn              = 34,
67c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCInstanceMethodDefn        = 35,
68c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_ObjCClassMethodDefn           = 36,
69c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff CXCursor_LastDefn                      = 36,
70c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroff
7189922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff /* References */
72fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_FirstRef                      = 40, /* Decl references */
73f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroff CXCursor_ObjCSuperClassRef             = 40,
74f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroff CXCursor_ObjCProtocolRef               = 41,
75fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_ObjCClassRef                  = 42,
76fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff
77fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_ObjCSelectorRef               = 43, /* Expression references */
78fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_ObjCIvarRef                   = 44,
79fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_VarRef                        = 45,
80fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_FunctionRef                   = 46,
81fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_EnumConstantRef               = 47,
82fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_MemberRef                     = 48,
83fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff CXCursor_LastRef                       = 48,
8477128ddd3077fc045751a55bb3226802b15d5510Steve Naroff
8577128ddd3077fc045751a55bb3226802b15d5510Steve Naroff /* Error conditions */
8677128ddd3077fc045751a55bb3226802b15d5510Steve Naroff CXCursor_FirstInvalid                  = 70,
8777128ddd3077fc045751a55bb3226802b15d5510Steve Naroff CXCursor_InvalidFile                   = 70,
8877128ddd3077fc045751a55bb3226802b15d5510Steve Naroff CXCursor_NoDeclFound                   = 71,
8977128ddd3077fc045751a55bb3226802b15d5510Steve Naroff CXCursor_NotImplemented                = 72,
9077128ddd3077fc045751a55bb3226802b15d5510Steve Naroff CXCursor_LastInvalid                   = 72
91600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff};
92600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
9389922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff/* A cursor into the CXTranslationUnit. */
94fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff
9589922f86f4e7da383af2a62ef04ad8b93b941220Steve Narofftypedef struct {
9689922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff  enum CXCursorKind kind;
9789922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff  CXDecl decl;
98fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroff  CXStmt stmt; /* expression reference */
9989922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff} CXCursor;
100600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
10150398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff/* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */
102e56b4baeba5097852e04bc41ca2e0396cf729955Steve Narofftypedef void *CXEntity;
103600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
104e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff/**
105e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * \brief clang_createIndex() provides a shared context for creating
106e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * translation units. It provides two options:
107e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
108e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
109e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * declarations (when loading any new translation units). A "local" declaration
110e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * is one that belongs in the translation unit itself and not in a precompiled
111e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * header that was used by the translation unit. If zero, all declarations
112e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * will be enumerated.
113e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
114e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * - displayDiagnostics: when non-zero, diagnostics will be output. If zero,
115e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * diagnostics will be ignored.
116e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */
117e56b4baeba5097852e04bc41ca2e0396cf729955Steve NaroffCXIndex clang_createIndex(int excludeDeclarationsFromPCH,
118e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff                          int displayDiagnostics);
119fb5704295c6137685a7b90b92cd6b958028740c8Steve Naroffvoid clang_disposeIndex(CXIndex);
120600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
121af08ddc8f1c53fed8d8d0ad82aa2a0bb7d654bd1Steve Naroffconst char *clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
122af08ddc8f1c53fed8d8d0ad82aa2a0bb7d654bd1Steve Naroff
123e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff/*
124e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * \brief Create a translation unit from an AST file (-emit-ast).
125e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff */
12650398199fb10e196a8d92fbf7a062dbe42ed88fdSteve NaroffCXTranslationUnit clang_createTranslationUnit(
127e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff  CXIndex, const char *ast_filename
128600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff);
1291374598619f83e6b2de91341a326eae564ece2cbTed Kremenek/**
1301374598619f83e6b2de91341a326eae564ece2cbTed Kremenek * \brief Destroy the specified CXTranslationUnit object.
1311374598619f83e6b2de91341a326eae564ece2cbTed Kremenek */
1321374598619f83e6b2de91341a326eae564ece2cbTed Kremenekvoid clang_disposeTranslationUnit(CXTranslationUnit);
1331374598619f83e6b2de91341a326eae564ece2cbTed Kremenek
1341374598619f83e6b2de91341a326eae564ece2cbTed Kremenek/**
135e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * \brief Return the CXTranslationUnit for a given source file and the provided
136e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * command line arguments one would pass to the compiler.
137e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff *
138e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * Note: If provided, this routine will strip the '-o <outputfile>' command
139e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff * line arguments.
1401374598619f83e6b2de91341a326eae564ece2cbTed Kremenek */
1415b7d8e254f6c2855b37b5521c0aee0a560dab237Steve NaroffCXTranslationUnit clang_createTranslationUnitFromSourceFile(
1425b7d8e254f6c2855b37b5521c0aee0a560dab237Steve Naroff  CXIndex CIdx,
1435b7d8e254f6c2855b37b5521c0aee0a560dab237Steve Naroff  const char *source_filename,
1445b7d8e254f6c2855b37b5521c0aee0a560dab237Steve Naroff  int num_clang_command_line_args,
145e56b4baeba5097852e04bc41ca2e0396cf729955Steve Naroff  const char **clang_command_line_args
1465b7d8e254f6c2855b37b5521c0aee0a560dab237Steve Naroff);
147600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
148600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff/*
149600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   Usage: clang_loadTranslationUnit(). Will load the toplevel declarations
150600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   within a translation unit, issuing a 'callback' for each one.
151600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
152600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   void printObjCInterfaceNames(CXTranslationUnit X, CXCursor C) {
153600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     if (clang_getCursorKind(C) == Cursor_Declaration) {
154600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       CXDecl D = clang_getCursorDecl(C);
155600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       if (clang_getDeclKind(D) == CXDecl_ObjC_interface)
156600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff         printf("@interface %s in file %s on line %d column %d\n",
157600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff                clang_getDeclSpelling(D), clang_getCursorSource(C),
158600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff                clang_getCursorLine(C), clang_getCursorColumn(C));
159600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     }
160600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   }
161600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   static void usage {
162600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     clang_loadTranslationUnit(CXTranslationUnit, printObjCInterfaceNames);
163600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   }
164600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff*/
1652b8ee6c2994f738e5162ff46b638974870f51662Steve Narofftypedef void *CXClientData;
1662b8ee6c2994f738e5162ff46b638974870f51662Steve Narofftypedef void (*CXTranslationUnitIterator)(CXTranslationUnit, CXCursor,
1672b8ee6c2994f738e5162ff46b638974870f51662Steve Naroff                                          CXClientData);
1682b8ee6c2994f738e5162ff46b638974870f51662Steve Naroffvoid clang_loadTranslationUnit(CXTranslationUnit, CXTranslationUnitIterator,
1692b8ee6c2994f738e5162ff46b638974870f51662Steve Naroff                               CXClientData);
170600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
171600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff/*
172600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   Usage: clang_loadDeclaration(). Will load the declaration, issuing a
173600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   'callback' for each declaration/reference within the respective declaration.
174600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
175600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   For interface declarations, this will index the super class, protocols,
176600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   ivars, methods, etc. For structure declarations, this will index the fields.
177600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   For functions, this will index the parameters (and body, for function
178600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   definitions), local declarations/references.
179600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
180600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   void getInterfaceDetails(CXDecl X, CXCursor C) {
181600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     switch (clang_getCursorKind(C)) {
182600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       case Cursor_ObjC_ClassRef:
183600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff         CXDecl SuperClass = clang_getCursorDecl(C);
184600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       case Cursor_ObjC_ProtocolRef:
185600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff         CXDecl AdoptsProtocol = clang_getCursorDecl(C);
186600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       case Cursor_Declaration:
187600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff         CXDecl AnIvarOrMethod = clang_getCursorDecl(C);
188600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     }
189600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   }
190600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   static void usage() {
191600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     if (clang_getDeclKind(D) == CXDecl_ObjC_interface) {
192600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff       clang_loadDeclaration(D, getInterfaceDetails);
193600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff     }
194600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff   }
195600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff*/
196c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Narofftypedef void (*CXDeclIterator)(CXDecl, CXCursor, CXClientData);
19789922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroff
198c857ea4d22e1e6dd9ede1f0e84d48b157c6924fdSteve Naroffvoid clang_loadDeclaration(CXDecl, CXDeclIterator, CXClientData);
199600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
20050398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff/*
20150398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff * CXEntity Operations.
20250398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
203600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffconst char *clang_getDeclarationName(CXEntity);
204600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffconst char *clang_getURI(CXEntity);
205600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve NaroffCXEntity clang_getEntity(const char *URI);
20650398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff/*
20750398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff * CXDecl Operations.
20850398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
209600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve NaroffCXCursor clang_getCursorFromDecl(CXDecl);
210600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve NaroffCXEntity clang_getEntityFromDecl(CXDecl);
211600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffconst char *clang_getDeclSpelling(CXDecl);
212699a07d8a0b1579c5178b3baf4bcf9edb6b38108Steve Naroffunsigned clang_getDeclLine(CXDecl);
213699a07d8a0b1579c5178b3baf4bcf9edb6b38108Steve Naroffunsigned clang_getDeclColumn(CXDecl);
214ee9405e807d7c447c0143c2bd865b759192e97b3Steve Naroffconst char *clang_getDeclSource(CXDecl);
215699a07d8a0b1579c5178b3baf4bcf9edb6b38108Steve Naroff
21650398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff/*
21750398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff * CXCursor Operations.
21850398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
219600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve NaroffCXCursor clang_getCursor(CXTranslationUnit, const char *source_name,
220600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff                         unsigned line, unsigned column);
221600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
22250398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroffenum CXCursorKind clang_getCursorKind(CXCursor);
22389922f86f4e7da383af2a62ef04ad8b93b941220Steve Naroffunsigned clang_isDeclaration(enum CXCursorKind);
224f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroffunsigned clang_isReference(enum CXCursorKind);
225f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroffunsigned clang_isDefinition(enum CXCursorKind);
22677128ddd3077fc045751a55bb3226802b15d5510Steve Naroffunsigned clang_isInvalid(enum CXCursorKind);
227600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
228600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffunsigned clang_getCursorLine(CXCursor);
229600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffunsigned clang_getCursorColumn(CXCursor);
230600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroffconst char *clang_getCursorSource(CXCursor);
231f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroffconst char *clang_getCursorSpelling(CXCursor);
232f334b4e3eda5a39f041fe13f805dbb53535daa2fSteve Naroff
2334ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff/* for debug/testing */
2344ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroffconst char *clang_getCursorKindSpelling(enum CXCursorKind Kind);
2354ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroffvoid clang_getDefinitionSpellingAndExtent(CXCursor,
2364ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **startBuf,
2374ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          const char **endBuf,
2384ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startLine,
2394ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *startColumn,
2404ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endLine,
2414ade6d6eae934f796ca43c81a5aa185e456dde9bSteve Naroff                                          unsigned *endColumn);
242600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve Naroff
24350398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff/*
244459789b8d2e3235e2f3342c393b7a78bd73c1347Chris Lattner * If CXCursorKind == Cursor_Reference, then this will return the referenced
245459789b8d2e3235e2f3342c393b7a78bd73c1347Chris Lattner * declaration.
24650398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff * If CXCursorKind == Cursor_Declaration, then this will return the declaration.
24750398199fb10e196a8d92fbf7a062dbe42ed88fdSteve Naroff */
248600866cc7d6d9ec2e27d4b6d6ec461f6463b5ab6Steve NaroffCXDecl clang_getCursorDecl(CXCursor);
249d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
250d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#ifdef __cplusplus
251d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek}
252d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
253d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek#endif
254d2fa56687f8bd5ac6ebf9d9468d0efd714986a54Ted Kremenek
255