Index.h revision ef0cef6cec8de5fc60e469a93436eed7212e0dc2
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#include <sys/stat.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/* MSVC DLL import/export. */
26#ifdef _MSC_VER
27  #ifdef _CINDEX_LIB_
28    #define CINDEX_LINKAGE __declspec(dllexport)
29  #else
30    #define CINDEX_LINKAGE __declspec(dllimport)
31  #endif
32#else
33  #define CINDEX_LINKAGE
34#endif
35
36/*
37   Clang indeX abstractions. The backing store for the following API's will be
38   clangs AST file (currently based on PCH). AST files are created as follows:
39
40   "clang -emit-ast <sourcefile.langsuffix> -o <sourcefile.ast>".
41
42   Naming Conventions: To avoid namespace pollution, data types are prefixed
43   with "CX" and functions are prefixed with "clang_".
44*/
45typedef void *CXIndex;            /* An indexing instance. */
46
47typedef void *CXTranslationUnit;  /* A translation unit instance. */
48
49typedef void *CXFile;    /* A source file */
50typedef void *CXDecl;    /* A specific declaration within a translation unit. */
51typedef void *CXStmt;    /* A specific statement within a function/method */
52
53/* Cursors represent declarations, definitions, and references. */
54enum CXCursorKind {
55 /* Declarations */
56 CXCursor_FirstDecl                     = 1,
57 CXCursor_TypedefDecl                   = 2,
58 CXCursor_StructDecl                    = 3,
59 CXCursor_UnionDecl                     = 4,
60 CXCursor_ClassDecl                     = 5,
61 CXCursor_EnumDecl                      = 6,
62 CXCursor_FieldDecl                     = 7,
63 CXCursor_EnumConstantDecl              = 8,
64 CXCursor_FunctionDecl                  = 9,
65 CXCursor_VarDecl                       = 10,
66 CXCursor_ParmDecl                      = 11,
67 CXCursor_ObjCInterfaceDecl             = 12,
68 CXCursor_ObjCCategoryDecl              = 13,
69 CXCursor_ObjCProtocolDecl              = 14,
70 CXCursor_ObjCPropertyDecl              = 15,
71 CXCursor_ObjCIvarDecl                  = 16,
72 CXCursor_ObjCInstanceMethodDecl        = 17,
73 CXCursor_ObjCClassMethodDecl           = 18,
74 CXCursor_LastDecl                      = 18,
75
76 /* Definitions */
77 CXCursor_FirstDefn                     = 32,
78 CXCursor_FunctionDefn                  = 32,
79 CXCursor_ObjCClassDefn                 = 33,
80 CXCursor_ObjCCategoryDefn              = 34,
81 CXCursor_ObjCInstanceMethodDefn        = 35,
82 CXCursor_ObjCClassMethodDefn           = 36,
83 CXCursor_LastDefn                      = 36,
84
85 /* References */
86 CXCursor_FirstRef                      = 40, /* Decl references */
87 CXCursor_ObjCSuperClassRef             = 40,
88 CXCursor_ObjCProtocolRef               = 41,
89 CXCursor_ObjCClassRef                  = 42,
90
91 CXCursor_ObjCSelectorRef               = 43, /* Expression references */
92 CXCursor_ObjCIvarRef                   = 44,
93 CXCursor_VarRef                        = 45,
94 CXCursor_FunctionRef                   = 46,
95 CXCursor_EnumConstantRef               = 47,
96 CXCursor_MemberRef                     = 48,
97 CXCursor_LastRef                       = 48,
98
99 /* Error conditions */
100 CXCursor_FirstInvalid                  = 70,
101 CXCursor_InvalidFile                   = 70,
102 CXCursor_NoDeclFound                   = 71,
103 CXCursor_NotImplemented                = 72,
104 CXCursor_LastInvalid                   = 72
105};
106
107/* A cursor into the CXTranslationUnit. */
108
109typedef struct {
110  enum CXCursorKind kind;
111  CXDecl decl;
112  CXStmt stmt; /* expression reference */
113} CXCursor;
114
115/* A unique token for looking up "visible" CXDecls from a CXTranslationUnit. */
116typedef void *CXEntity;
117
118/**
119 * For functions returning a string that might or might not need
120 * to be internally allocated and freed.
121 * Use clang_getCString to access the C string value.
122 * Use clang_disposeString to free the value.
123 * Treat it as an opaque type.
124 */
125typedef struct {
126  const char *Spelling;
127  /* A 1 value indicates the clang_ indexing API needed to allocate the string
128     (and it must be freed by clang_disposeString()). */
129  int MustFreeString;
130} CXString;
131
132/* Get C string pointer from a CXString. */
133CINDEX_LINKAGE const char *clang_getCString(CXString string);
134
135/* Free CXString. */
136CINDEX_LINKAGE void clang_disposeString(CXString string);
137
138/**
139 * \brief clang_createIndex() provides a shared context for creating
140 * translation units. It provides two options:
141 *
142 * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
143 * declarations (when loading any new translation units). A "local" declaration
144 * is one that belongs in the translation unit itself and not in a precompiled
145 * header that was used by the translation unit. If zero, all declarations
146 * will be enumerated.
147 *
148 * - displayDiagnostics: when non-zero, diagnostics will be output. If zero,
149 * diagnostics will be ignored.
150 *
151 * Here is an example:
152 *
153 *   // excludeDeclsFromPCH = 1, displayDiagnostics = 1
154 *   Idx = clang_createIndex(1, 1);
155 *
156 *   // IndexTest.pch was produced with the following command:
157 *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
158 *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
159 *
160 *   // This will load all the symbols from 'IndexTest.pch'
161 *   clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
162 *   clang_disposeTranslationUnit(TU);
163 *
164 *   // This will load all the symbols from 'IndexTest.c', excluding symbols
165 *   // from 'IndexTest.pch'.
166 *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch", 0 };
167 *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args);
168 *   clang_loadTranslationUnit(TU, TranslationUnitVisitor, 0);
169 *   clang_disposeTranslationUnit(TU);
170 *
171 * This process of creating the 'pch', loading it separately, and using it (via
172 * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
173 * (which gives the indexer the same performance benefit as the compiler).
174 */
175CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
176                          int displayDiagnostics);
177CINDEX_LINKAGE void clang_disposeIndex(CXIndex);
178CINDEX_LINKAGE CXString clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
179
180/*
181 * \brief Create a translation unit from an AST file (-emit-ast).
182 */
183CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(
184  CXIndex, const char *ast_filename
185);
186/**
187 * \brief Destroy the specified CXTranslationUnit object.
188 */
189CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
190
191/**
192 * \brief Return the CXTranslationUnit for a given source file and the provided
193 * command line arguments one would pass to the compiler.
194 *
195 * Note: The 'source_filename' argument is optional.  If the caller provides a NULL pointer,
196 *  the name of the source file is expected to reside in the specified command line arguments.
197 *
198 * Note: When encountered in 'clang_command_line_args', the following options are ignored:
199 *
200 *   '-c'
201 *   '-emit-ast'
202 *   '-fsyntax-only'
203 *   '-o <output file>'  (both '-o' and '<output file>' are ignored)
204 *
205 */
206CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
207  CXIndex CIdx,
208  const char *source_filename /* specify NULL if the source file is in clang_command_line_args */,
209  int num_clang_command_line_args,
210  const char **clang_command_line_args
211);
212
213/*
214   Usage: clang_loadTranslationUnit(). Will load the toplevel declarations
215   within a translation unit, issuing a 'callback' for each one.
216
217   void printObjCInterfaceNames(CXTranslationUnit X, CXCursor C) {
218     if (clang_getCursorKind(C) == Cursor_Declaration) {
219       CXDecl D = clang_getCursorDecl(C);
220       if (clang_getDeclKind(D) == CXDecl_ObjC_interface)
221         printf("@interface %s in file %s on line %d column %d\n",
222                clang_getDeclSpelling(D), clang_getCursorSource(C),
223                clang_getCursorLine(C), clang_getCursorColumn(C));
224     }
225   }
226   static void usage {
227     clang_loadTranslationUnit(CXTranslationUnit, printObjCInterfaceNames);
228   }
229*/
230typedef void *CXClientData;
231typedef void (*CXTranslationUnitIterator)(CXTranslationUnit, CXCursor,
232                                          CXClientData);
233CINDEX_LINKAGE void clang_loadTranslationUnit(CXTranslationUnit, CXTranslationUnitIterator,
234                               CXClientData);
235
236/*
237   Usage: clang_loadDeclaration(). Will load the declaration, issuing a
238   'callback' for each declaration/reference within the respective declaration.
239
240   For interface declarations, this will index the super class, protocols,
241   ivars, methods, etc. For structure declarations, this will index the fields.
242   For functions, this will index the parameters (and body, for function
243   definitions), local declarations/references.
244
245   void getInterfaceDetails(CXDecl X, CXCursor C) {
246     switch (clang_getCursorKind(C)) {
247       case Cursor_ObjC_ClassRef:
248         CXDecl SuperClass = clang_getCursorDecl(C);
249       case Cursor_ObjC_ProtocolRef:
250         CXDecl AdoptsProtocol = clang_getCursorDecl(C);
251       case Cursor_Declaration:
252         CXDecl AnIvarOrMethod = clang_getCursorDecl(C);
253     }
254   }
255   static void usage() {
256     if (clang_getDeclKind(D) == CXDecl_ObjC_interface) {
257       clang_loadDeclaration(D, getInterfaceDetails);
258     }
259   }
260*/
261typedef void (*CXDeclIterator)(CXDecl, CXCursor, CXClientData);
262
263CINDEX_LINKAGE void clang_loadDeclaration(CXDecl, CXDeclIterator, CXClientData);
264
265/*
266 * CXFile Operations.
267 */
268CINDEX_LINKAGE const char *clang_getFileName(CXFile SFile);
269CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
270
271/*
272 * CXEntity Operations.
273 */
274CINDEX_LINKAGE const char *clang_getDeclarationName(CXEntity);
275CINDEX_LINKAGE const char *clang_getURI(CXEntity);
276CINDEX_LINKAGE CXEntity clang_getEntity(const char *URI);
277/*
278 * CXDecl Operations.
279 */
280CINDEX_LINKAGE CXCursor clang_getCursorFromDecl(CXDecl);
281CINDEX_LINKAGE CXEntity clang_getEntityFromDecl(CXDecl);
282CINDEX_LINKAGE CXString clang_getDeclSpelling(CXDecl);
283CINDEX_LINKAGE unsigned clang_getDeclLine(CXDecl);
284CINDEX_LINKAGE unsigned clang_getDeclColumn(CXDecl);
285CINDEX_LINKAGE const char *clang_getDeclSource(CXDecl); /* deprecate */
286CINDEX_LINKAGE CXFile clang_getDeclSourceFile(CXDecl);
287
288/*
289 * CXCursor Operations.
290 */
291/**
292   Usage: clang_getCursor() will translate a source/line/column position
293   into an AST cursor (to derive semantic information from the source code).
294 */
295CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, const char *source_name,
296                         unsigned line, unsigned column);
297
298CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
299CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
300CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
301CINDEX_LINKAGE unsigned clang_isDefinition(enum CXCursorKind);
302CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
303
304CINDEX_LINKAGE unsigned clang_getCursorLine(CXCursor);
305CINDEX_LINKAGE unsigned clang_getCursorColumn(CXCursor);
306CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
307CINDEX_LINKAGE const char *clang_getCursorSource(CXCursor); /* deprecate */
308CINDEX_LINKAGE CXFile clang_getCursorSourceFile(CXCursor);
309
310/* for debug/testing */
311CINDEX_LINKAGE const char *clang_getCursorKindSpelling(enum CXCursorKind Kind);
312CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
313                                          const char **startBuf,
314                                          const char **endBuf,
315                                          unsigned *startLine,
316                                          unsigned *startColumn,
317                                          unsigned *endLine,
318                                          unsigned *endColumn);
319
320/*
321 * If CXCursorKind == Cursor_Reference, then this will return the referenced
322 * declaration.
323 * If CXCursorKind == Cursor_Declaration, then this will return the declaration.
324 */
325CINDEX_LINKAGE CXDecl clang_getCursorDecl(CXCursor);
326
327/**
328 * \brief A semantic string that describes a code-completion result.
329 *
330 * A semantic string that describes the formatting of a code-completion
331 * result as a single "template" of text that should be inserted into the
332 * source buffer when a particular code-completion result is selected.
333 * Each semantic string is made up of some number of "chunks", each of which
334 * contains some text along with a description of what that text means, e.g.,
335 * the name of the entity being referenced, whether the text chunk is part of
336 * the template, or whether it is a "placeholder" that the user should replace
337 * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
338 * description of the different kinds of chunks.
339 */
340typedef void *CXCompletionString;
341
342/**
343 * \brief A single result of code completion.
344 */
345typedef struct {
346  /**
347   * \brief The kind of entity that this completion refers to.
348   *
349   * The cursor kind will be a macro, keyword, or a declaration (one of the
350   * *Decl cursor kinds), describing the entity that the completion is
351   * referring to.
352   *
353   * \todo In the future, we would like to provide a full cursor, to allow
354   * the client to extract additional information from declaration.
355   */
356  enum CXCursorKind CursorKind;
357
358  /**
359   * \brief The code-completion string that describes how to insert this
360   * code-completion result into the editing buffer.
361   */
362  CXCompletionString CompletionString;
363} CXCompletionResult;
364
365/**
366 * \brief Describes a single piece of text within a code-completion string.
367 *
368 * Each "chunk" within a code-completion string (\c CXCompletionString) is
369 * either a piece of text with a specific "kind" that describes how that text
370 * should be interpreted by the client or is another completion string.
371 */
372enum CXCompletionChunkKind {
373  /**
374   * \brief A code-completion string that describes "optional" text that
375   * could be a part of the template (but is not required).
376   *
377   * The Optional chunk is the only kind of chunk that has a code-completion
378   * string for its representation, which is accessible via
379   * \c clang_getCompletionChunkCompletionString(). The code-completion string
380   * describes an additional part of the template that is completely optional.
381   * For example, optional chunks can be used to describe the placeholders for
382   * arguments that match up with defaulted function parameters, e.g. given:
383   *
384   * \code
385   * void f(int x, float y = 3.14, double z = 2.71828);
386   * \endcode
387   *
388   * The code-completion string for this function would contain:
389   *   - a TypedText chunk for "f".
390   *   - a LeftParen chunk for "(".
391   *   - a Placeholder chunk for "int x"
392   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
393   *       - a Comma chunk for ","
394   *       - a Placeholder chunk for "float x"
395   *       - an Optional chunk containing the last defaulted argument:
396   *           - a Comma chunk for ","
397   *           - a Placeholder chunk for "double z"
398   *   - a RightParen chunk for ")"
399   *
400   * There are many ways two handle Optional chunks. Two simple approaches are:
401   *   - Completely ignore optional chunks, in which case the template for the
402   *     function "f" would only include the first parameter ("int x").
403   *   - Fully expand all optional chunks, in which case the template for the
404   *     function "f" would have all of the parameters.
405   */
406  CXCompletionChunk_Optional,
407  /**
408   * \brief Text that a user would be expected to type to get this
409   * code-completion result.
410   *
411   * There will be exactly one "typed text" chunk in a semantic string, which
412   * will typically provide the spelling of a keyword or the name of a
413   * declaration that could be used at the current code point. Clients are
414   * expected to filter the code-completion results based on the text in this
415   * chunk.
416   */
417  CXCompletionChunk_TypedText,
418  /**
419   * \brief Text that should be inserted as part of a code-completion result.
420   *
421   * A "text" chunk represents text that is part of the template to be
422   * inserted into user code should this particular code-completion result
423   * be selected.
424   */
425  CXCompletionChunk_Text,
426  /**
427   * \brief Placeholder text that should be replaced by the user.
428   *
429   * A "placeholder" chunk marks a place where the user should insert text
430   * into the code-completion template. For example, placeholders might mark
431   * the function parameters for a function declaration, to indicate that the
432   * user should provide arguments for each of those parameters. The actual
433   * text in a placeholder is a suggestion for the text to display before
434   * the user replaces the placeholder with real code.
435   */
436  CXCompletionChunk_Placeholder,
437  /**
438   * \brief Informative text that should be displayed but never inserted as
439   * part of the template.
440   *
441   * An "informative" chunk contains annotations that can be displayed to
442   * help the user decide whether a particular code-completion result is the
443   * right option, but which is not part of the actual template to be inserted
444   * by code completion.
445   */
446  CXCompletionChunk_Informative,
447  /**
448   * \brief Text that describes the current parameter when code-completion is
449   * referring to function call, message send, or template specialization.
450   *
451   * A "current parameter" chunk occurs when code-completion is providing
452   * information about a parameter corresponding to the argument at the
453   * code-completion point. For example, given a function
454   *
455   * \code
456   * int add(int x, int y);
457   * \endcode
458   *
459   * and the source code \c add(, where the code-completion point is after the
460   * "(", the code-completion string will contain a "current parameter" chunk
461   * for "int x", indicating that the current argument will initialize that
462   * parameter. After typing further, to \c add(17, (where the code-completion
463   * point is after the ","), the code-completion string will contain a
464   * "current paremeter" chunk to "int y".
465   */
466  CXCompletionChunk_CurrentParameter,
467  /**
468   * \brief A left parenthesis ('('), used to initiate a function call or
469   * signal the beginning of a function parameter list.
470   */
471  CXCompletionChunk_LeftParen,
472  /**
473   * \brief A right parenthesis (')'), used to finish a function call or
474   * signal the end of a function parameter list.
475   */
476  CXCompletionChunk_RightParen,
477  /**
478   * \brief A left bracket ('[').
479   */
480  CXCompletionChunk_LeftBracket,
481  /**
482   * \brief A right bracket (']').
483   */
484  CXCompletionChunk_RightBracket,
485  /**
486   * \brief A left brace ('{').
487   */
488  CXCompletionChunk_LeftBrace,
489  /**
490   * \brief A right brace ('}').
491   */
492  CXCompletionChunk_RightBrace,
493  /**
494   * \brief A left angle bracket ('<').
495   */
496  CXCompletionChunk_LeftAngle,
497  /**
498   * \brief A right angle bracket ('>').
499   */
500  CXCompletionChunk_RightAngle,
501  /**
502   * \brief A comma separator (',').
503   */
504  CXCompletionChunk_Comma
505};
506
507/**
508 * \brief Callback function that receives a single code-completion result.
509 *
510 * This callback will be invoked by \c clang_codeComplete() for each
511 * code-completion result.
512 *
513 * \param completion_result a pointer to the current code-completion result,
514 * providing one possible completion. The pointer itself is only valid
515 * during the execution of the completion callback.
516 *
517 * \param client_data the client data provided to \c clang_codeComplete().
518 */
519typedef void (*CXCompletionIterator)(CXCompletionResult *completion_result,
520                                     CXClientData client_data);
521
522/**
523 * \brief Determine the kind of a particular chunk within a completion string.
524 *
525 * \param completion_string the completion string to query.
526 *
527 * \param chunk_number the 0-based index of the chunk in the completion string.
528 *
529 * \returns the kind of the chunk at the index \c chunk_number.
530 */
531CINDEX_LINKAGE enum CXCompletionChunkKind
532clang_getCompletionChunkKind(CXCompletionString completion_string,
533                             unsigned chunk_number);
534
535/**
536 * \brief Retrieve the text associated with a particular chunk within a
537 * completion string.
538 *
539 * \param completion_string the completion string to query.
540 *
541 * \param chunk_number the 0-based index of the chunk in the completion string.
542 *
543 * \returns the text associated with the chunk at index \c chunk_number.
544 */
545CINDEX_LINKAGE const char *
546clang_getCompletionChunkText(CXCompletionString completion_string,
547                             unsigned chunk_number);
548
549/**
550 * \brief Retrieve the completion string associated with a particular chunk
551 * within a completion string.
552 *
553 * \param completion_string the completion string to query.
554 *
555 * \param chunk_number the 0-based index of the chunk in the completion string.
556 *
557 * \returns the completion string associated with the chunk at index
558 * \c chunk_number, or NULL if that chunk is not represented by a completion
559 * string.
560 */
561CINDEX_LINKAGE CXCompletionString
562clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
563                                         unsigned chunk_number);
564
565/**
566 * \brief Retrieve the number of chunks in the given code-completion string.
567 */
568CINDEX_LINKAGE unsigned
569clang_getNumCompletionChunks(CXCompletionString completion_string);
570
571/**
572 * \brief Perform code completion at a given location in a source file.
573 *
574 * This function performs code completion at a particular file, line, and
575 * column within source code, providing results that suggest potential
576 * code snippets based on the context of the completion. The basic model
577 * for code completion is that Clang will parse a complete source file,
578 * performing syntax checking up to the location where code-completion has
579 * been requested. At that point, a special code-completion token is passed
580 * to the parser, which recognizes this token and determines, based on the
581 * current location in the C/Objective-C/C++ grammar and the state of
582 * semantic analysis, what completions to provide. These completions are
583 * enumerated through a callback interface to the client.
584 *
585 * Code completion itself is meant to be triggered by the client when the
586 * user types punctuation characters or whitespace, at which point the
587 * code-completion location will coincide with the cursor. For example, if \c p
588 * is a pointer, code-completion might be triggered after the "-" and then
589 * after the ">" in \c p->. When the code-completion location is afer the ">",
590 * the completion results will provide, e.g., the members of the struct that
591 * "p" points to. The client is responsible for placing the cursor at the
592 * beginning of the token currently being typed, then filtering the results
593 * based on the contents of the token. For example, when code-completing for
594 * the expression \c p->get, the client should provide the location just after
595 * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
596 * client can filter the results based on the current token text ("get"), only
597 * showing those results that start with "get". The intent of this interface
598 * is to separate the relatively high-latency acquisition of code-competion
599 * results from the filtering of results on a per-character basis, which must
600 * have a lower latency.
601 *
602 * \param CIdx the \c CXIndex instance that will be used to perform code
603 * completion.
604 *
605 * \param source_filename the name of the source file that should be parsed
606 * to perform code-completion. This source file must be the same as or
607 * include the filename described by \p complete_filename, or no code-completion
608 * results will be produced.
609 *
610 * \param num_command_line_args the number of command-line arguments stored in
611 * \p command_line_args.
612 *
613 * \param command_line_args the command-line arguments to pass to the Clang
614 * compiler to build the given source file. This should include all of the
615 * necessary include paths, language-dialect switches, precompiled header
616 * includes, etc., but should not include any information specific to
617 * code completion.
618 *
619 * \param complete_filename the name of the source file where code completion
620 * should be performed. In many cases, this name will be the same as the
621 * source filename. However, the completion filename may also be a file
622 * included by the source file, which is required when producing
623 * code-completion results for a header.
624 *
625 * \param complete_line the line at which code-completion should occur.
626 *
627 * \param complete_column the column at which code-completion should occur.
628 * Note that the column should point just after the syntactic construct that
629 * initiated code completion, and not in the middle of a lexical token.
630 *
631 * \param completion_iterator a callback function that will receive
632 * code-completion results.
633 *
634 * \param client_data client-specific data that will be passed back via the
635 * code-completion callback function.
636 */
637CINDEX_LINKAGE void clang_codeComplete(CXIndex CIdx,
638                                       const char *source_filename,
639                                       int num_command_line_args,
640                                       const char **command_line_args,
641                                       const char *complete_filename,
642                                       unsigned complete_line,
643                                       unsigned complete_column,
644                                       CXCompletionIterator completion_iterator,
645                                       CXClientData client_data);
646
647
648#ifdef __cplusplus
649}
650#endif
651#endif
652
653