Index.h revision 8fa0a80b4482ad94e82c4a19e23de17fd69140b5
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#include <time.h>
21#include <stdio.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* MSVC DLL import/export. */
28#ifdef _MSC_VER
29  #ifdef _CINDEX_LIB_
30    #define CINDEX_LINKAGE __declspec(dllexport)
31  #else
32    #define CINDEX_LINKAGE __declspec(dllimport)
33  #endif
34#else
35  #define CINDEX_LINKAGE
36#endif
37
38/** \defgroup CINDEX libclang: C Interface to Clang
39 *
40 * The C Interface to Clang provides a relatively small API that exposes
41 * facilities for parsing source code into an abstract syntax tree (AST),
42 * loading already-parsed ASTs, traversing the AST, associating
43 * physical source locations with elements within the AST, and other
44 * facilities that support Clang-based development tools.
45 *
46 * This C interface to Clang will never provide all of the information
47 * representation stored in Clang's C++ AST, nor should it: the intent is to
48 * maintain an API that is relatively stable from one release to the next,
49 * providing only the basic functionality needed to support development tools.
50 *
51 * To avoid namespace pollution, data types are prefixed with "CX" and
52 * functions are prefixed with "clang_".
53 *
54 * @{
55 */
56
57/**
58 * \brief An "index" that consists of a set of translation units that would
59 * typically be linked together into an executable or library.
60 */
61typedef void *CXIndex;
62
63/**
64 * \brief A single translation unit, which resides in an index.
65 */
66typedef struct CXTranslationUnitImpl *CXTranslationUnit;
67
68/**
69 * \brief Opaque pointer representing client data that will be passed through
70 * to various callbacks and visitors.
71 */
72typedef void *CXClientData;
73
74/**
75 * \brief Provides the contents of a file that has not yet been saved to disk.
76 *
77 * Each CXUnsavedFile instance provides the name of a file on the
78 * system along with the current contents of that file that have not
79 * yet been saved to disk.
80 */
81struct CXUnsavedFile {
82  /**
83   * \brief The file whose contents have not yet been saved.
84   *
85   * This file must already exist in the file system.
86   */
87  const char *Filename;
88
89  /**
90   * \brief A buffer containing the unsaved contents of this file.
91   */
92  const char *Contents;
93
94  /**
95   * \brief The length of the unsaved contents of this buffer.
96   */
97  unsigned long Length;
98};
99
100/**
101 * \brief Describes the availability of a particular entity, which indicates
102 * whether the use of this entity will result in a warning or error due to
103 * it being deprecated or unavailable.
104 */
105enum CXAvailabilityKind {
106  /**
107   * \brief The entity is available.
108   */
109  CXAvailability_Available,
110  /**
111   * \brief The entity is available, but has been deprecated (and its use is
112   * not recommended).
113   */
114  CXAvailability_Deprecated,
115  /**
116   * \brief The entity is not available; any use of it will be an error.
117   */
118  CXAvailability_NotAvailable
119};
120
121/**
122 * \defgroup CINDEX_STRING String manipulation routines
123 *
124 * @{
125 */
126
127/**
128 * \brief A character string.
129 *
130 * The \c CXString type is used to return strings from the interface when
131 * the ownership of that string might different from one call to the next.
132 * Use \c clang_getCString() to retrieve the string data and, once finished
133 * with the string data, call \c clang_disposeString() to free the string.
134 */
135typedef struct {
136  void *data;
137  unsigned private_flags;
138} CXString;
139
140/**
141 * \brief Retrieve the character data associated with the given string.
142 */
143CINDEX_LINKAGE const char *clang_getCString(CXString string);
144
145/**
146 * \brief Free the given string,
147 */
148CINDEX_LINKAGE void clang_disposeString(CXString string);
149
150/**
151 * @}
152 */
153
154/**
155 * \brief clang_createIndex() provides a shared context for creating
156 * translation units. It provides two options:
157 *
158 * - excludeDeclarationsFromPCH: When non-zero, allows enumeration of "local"
159 * declarations (when loading any new translation units). A "local" declaration
160 * is one that belongs in the translation unit itself and not in a precompiled
161 * header that was used by the translation unit. If zero, all declarations
162 * will be enumerated.
163 *
164 * Here is an example:
165 *
166 *   // excludeDeclsFromPCH = 1, displayDiagnostics=1
167 *   Idx = clang_createIndex(1, 1);
168 *
169 *   // IndexTest.pch was produced with the following command:
170 *   // "clang -x c IndexTest.h -emit-ast -o IndexTest.pch"
171 *   TU = clang_createTranslationUnit(Idx, "IndexTest.pch");
172 *
173 *   // This will load all the symbols from 'IndexTest.pch'
174 *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
175 *                       TranslationUnitVisitor, 0);
176 *   clang_disposeTranslationUnit(TU);
177 *
178 *   // This will load all the symbols from 'IndexTest.c', excluding symbols
179 *   // from 'IndexTest.pch'.
180 *   char *args[] = { "-Xclang", "-include-pch=IndexTest.pch" };
181 *   TU = clang_createTranslationUnitFromSourceFile(Idx, "IndexTest.c", 2, args,
182 *                                                  0, 0);
183 *   clang_visitChildren(clang_getTranslationUnitCursor(TU),
184 *                       TranslationUnitVisitor, 0);
185 *   clang_disposeTranslationUnit(TU);
186 *
187 * This process of creating the 'pch', loading it separately, and using it (via
188 * -include-pch) allows 'excludeDeclsFromPCH' to remove redundant callbacks
189 * (which gives the indexer the same performance benefit as the compiler).
190 */
191CINDEX_LINKAGE CXIndex clang_createIndex(int excludeDeclarationsFromPCH,
192                                         int displayDiagnostics);
193
194/**
195 * \brief Destroy the given index.
196 *
197 * The index must not be destroyed until all of the translation units created
198 * within that index have been destroyed.
199 */
200CINDEX_LINKAGE void clang_disposeIndex(CXIndex index);
201
202/**
203 * \defgroup CINDEX_FILES File manipulation routines
204 *
205 * @{
206 */
207
208/**
209 * \brief A particular source file that is part of a translation unit.
210 */
211typedef void *CXFile;
212
213
214/**
215 * \brief Retrieve the complete file and path name of the given file.
216 */
217CINDEX_LINKAGE CXString clang_getFileName(CXFile SFile);
218
219/**
220 * \brief Retrieve the last modification time of the given file.
221 */
222CINDEX_LINKAGE time_t clang_getFileTime(CXFile SFile);
223
224/**
225 * \brief Determine whether the given header is guarded against
226 * multiple inclusions, either with the conventional
227 * #ifndef/#define/#endif macro guards or with #pragma once.
228 */
229CINDEX_LINKAGE unsigned
230clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file);
231
232/**
233 * \brief Retrieve a file handle within the given translation unit.
234 *
235 * \param tu the translation unit
236 *
237 * \param file_name the name of the file.
238 *
239 * \returns the file handle for the named file in the translation unit \p tu,
240 * or a NULL file handle if the file was not a part of this translation unit.
241 */
242CINDEX_LINKAGE CXFile clang_getFile(CXTranslationUnit tu,
243                                    const char *file_name);
244
245/**
246 * @}
247 */
248
249/**
250 * \defgroup CINDEX_LOCATIONS Physical source locations
251 *
252 * Clang represents physical source locations in its abstract syntax tree in
253 * great detail, with file, line, and column information for the majority of
254 * the tokens parsed in the source code. These data types and functions are
255 * used to represent source location information, either for a particular
256 * point in the program or for a range of points in the program, and extract
257 * specific location information from those data types.
258 *
259 * @{
260 */
261
262/**
263 * \brief Identifies a specific source location within a translation
264 * unit.
265 *
266 * Use clang_getInstantiationLocation() or clang_getSpellingLocation()
267 * to map a source location to a particular file, line, and column.
268 */
269typedef struct {
270  void *ptr_data[2];
271  unsigned int_data;
272} CXSourceLocation;
273
274/**
275 * \brief Identifies a half-open character range in the source code.
276 *
277 * Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
278 * starting and end locations from a source range, respectively.
279 */
280typedef struct {
281  void *ptr_data[2];
282  unsigned begin_int_data;
283  unsigned end_int_data;
284} CXSourceRange;
285
286/**
287 * \brief Retrieve a NULL (invalid) source location.
288 */
289CINDEX_LINKAGE CXSourceLocation clang_getNullLocation();
290
291/**
292 * \determine Determine whether two source locations, which must refer into
293 * the same translation unit, refer to exactly the same point in the source
294 * code.
295 *
296 * \returns non-zero if the source locations refer to the same location, zero
297 * if they refer to different locations.
298 */
299CINDEX_LINKAGE unsigned clang_equalLocations(CXSourceLocation loc1,
300                                             CXSourceLocation loc2);
301
302/**
303 * \brief Retrieves the source location associated with a given file/line/column
304 * in a particular translation unit.
305 */
306CINDEX_LINKAGE CXSourceLocation clang_getLocation(CXTranslationUnit tu,
307                                                  CXFile file,
308                                                  unsigned line,
309                                                  unsigned column);
310/**
311 * \brief Retrieves the source location associated with a given character offset
312 * in a particular translation unit.
313 */
314CINDEX_LINKAGE CXSourceLocation clang_getLocationForOffset(CXTranslationUnit tu,
315                                                           CXFile file,
316                                                           unsigned offset);
317
318/**
319 * \brief Retrieve a NULL (invalid) source range.
320 */
321CINDEX_LINKAGE CXSourceRange clang_getNullRange();
322
323/**
324 * \brief Retrieve a source range given the beginning and ending source
325 * locations.
326 */
327CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
328                                            CXSourceLocation end);
329
330/**
331 * \brief Determine whether two ranges are equivalent.
332 *
333 * \returns non-zero if the ranges are the same, zero if they differ.
334 */
335CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
336                                          CXSourceRange range2);
337
338/**
339 * \brief Retrieve the file, line, column, and offset represented by
340 * the given source location.
341 *
342 * If the location refers into a macro instantiation, retrieves the
343 * location of the macro instantiation.
344 *
345 * \param location the location within a source file that will be decomposed
346 * into its parts.
347 *
348 * \param file [out] if non-NULL, will be set to the file to which the given
349 * source location points.
350 *
351 * \param line [out] if non-NULL, will be set to the line to which the given
352 * source location points.
353 *
354 * \param column [out] if non-NULL, will be set to the column to which the given
355 * source location points.
356 *
357 * \param offset [out] if non-NULL, will be set to the offset into the
358 * buffer to which the given source location points.
359 */
360CINDEX_LINKAGE void clang_getInstantiationLocation(CXSourceLocation location,
361                                                   CXFile *file,
362                                                   unsigned *line,
363                                                   unsigned *column,
364                                                   unsigned *offset);
365
366/**
367 * \brief Retrieve the file, line, column, and offset represented by
368 * the given source location.
369 *
370 * If the location refers into a macro instantiation, return where the
371 * location was originally spelled in the source file.
372 *
373 * \param location the location within a source file that will be decomposed
374 * into its parts.
375 *
376 * \param file [out] if non-NULL, will be set to the file to which the given
377 * source location points.
378 *
379 * \param line [out] if non-NULL, will be set to the line to which the given
380 * source location points.
381 *
382 * \param column [out] if non-NULL, will be set to the column to which the given
383 * source location points.
384 *
385 * \param offset [out] if non-NULL, will be set to the offset into the
386 * buffer to which the given source location points.
387 */
388CINDEX_LINKAGE void clang_getSpellingLocation(CXSourceLocation location,
389                                              CXFile *file,
390                                              unsigned *line,
391                                              unsigned *column,
392                                              unsigned *offset);
393
394/**
395 * \brief Retrieve a source location representing the first character within a
396 * source range.
397 */
398CINDEX_LINKAGE CXSourceLocation clang_getRangeStart(CXSourceRange range);
399
400/**
401 * \brief Retrieve a source location representing the last character within a
402 * source range.
403 */
404CINDEX_LINKAGE CXSourceLocation clang_getRangeEnd(CXSourceRange range);
405
406/**
407 * @}
408 */
409
410/**
411 * \defgroup CINDEX_DIAG Diagnostic reporting
412 *
413 * @{
414 */
415
416/**
417 * \brief Describes the severity of a particular diagnostic.
418 */
419enum CXDiagnosticSeverity {
420  /**
421   * \brief A diagnostic that has been suppressed, e.g., by a command-line
422   * option.
423   */
424  CXDiagnostic_Ignored = 0,
425
426  /**
427   * \brief This diagnostic is a note that should be attached to the
428   * previous (non-note) diagnostic.
429   */
430  CXDiagnostic_Note    = 1,
431
432  /**
433   * \brief This diagnostic indicates suspicious code that may not be
434   * wrong.
435   */
436  CXDiagnostic_Warning = 2,
437
438  /**
439   * \brief This diagnostic indicates that the code is ill-formed.
440   */
441  CXDiagnostic_Error   = 3,
442
443  /**
444   * \brief This diagnostic indicates that the code is ill-formed such
445   * that future parser recovery is unlikely to produce useful
446   * results.
447   */
448  CXDiagnostic_Fatal   = 4
449};
450
451/**
452 * \brief A single diagnostic, containing the diagnostic's severity,
453 * location, text, source ranges, and fix-it hints.
454 */
455typedef void *CXDiagnostic;
456
457/**
458 * \brief Determine the number of diagnostics produced for the given
459 * translation unit.
460 */
461CINDEX_LINKAGE unsigned clang_getNumDiagnostics(CXTranslationUnit Unit);
462
463/**
464 * \brief Retrieve a diagnostic associated with the given translation unit.
465 *
466 * \param Unit the translation unit to query.
467 * \param Index the zero-based diagnostic number to retrieve.
468 *
469 * \returns the requested diagnostic. This diagnostic must be freed
470 * via a call to \c clang_disposeDiagnostic().
471 */
472CINDEX_LINKAGE CXDiagnostic clang_getDiagnostic(CXTranslationUnit Unit,
473                                                unsigned Index);
474
475/**
476 * \brief Destroy a diagnostic.
477 */
478CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
479
480/**
481 * \brief Options to control the display of diagnostics.
482 *
483 * The values in this enum are meant to be combined to customize the
484 * behavior of \c clang_displayDiagnostic().
485 */
486enum CXDiagnosticDisplayOptions {
487  /**
488   * \brief Display the source-location information where the
489   * diagnostic was located.
490   *
491   * When set, diagnostics will be prefixed by the file, line, and
492   * (optionally) column to which the diagnostic refers. For example,
493   *
494   * \code
495   * test.c:28: warning: extra tokens at end of #endif directive
496   * \endcode
497   *
498   * This option corresponds to the clang flag \c -fshow-source-location.
499   */
500  CXDiagnostic_DisplaySourceLocation = 0x01,
501
502  /**
503   * \brief If displaying the source-location information of the
504   * diagnostic, also include the column number.
505   *
506   * This option corresponds to the clang flag \c -fshow-column.
507   */
508  CXDiagnostic_DisplayColumn = 0x02,
509
510  /**
511   * \brief If displaying the source-location information of the
512   * diagnostic, also include information about source ranges in a
513   * machine-parsable format.
514   *
515   * This option corresponds to the clang flag
516   * \c -fdiagnostics-print-source-range-info.
517   */
518  CXDiagnostic_DisplaySourceRanges = 0x04,
519
520  /**
521   * \brief Display the option name associated with this diagnostic, if any.
522   *
523   * The option name displayed (e.g., -Wconversion) will be placed in brackets
524   * after the diagnostic text. This option corresponds to the clang flag
525   * \c -fdiagnostics-show-option.
526   */
527  CXDiagnostic_DisplayOption = 0x08,
528
529  /**
530   * \brief Display the category number associated with this diagnostic, if any.
531   *
532   * The category number is displayed within brackets after the diagnostic text.
533   * This option corresponds to the clang flag
534   * \c -fdiagnostics-show-category=id.
535   */
536  CXDiagnostic_DisplayCategoryId = 0x10,
537
538  /**
539   * \brief Display the category name associated with this diagnostic, if any.
540   *
541   * The category name is displayed within brackets after the diagnostic text.
542   * This option corresponds to the clang flag
543   * \c -fdiagnostics-show-category=name.
544   */
545  CXDiagnostic_DisplayCategoryName = 0x20
546};
547
548/**
549 * \brief Format the given diagnostic in a manner that is suitable for display.
550 *
551 * This routine will format the given diagnostic to a string, rendering
552 * the diagnostic according to the various options given. The
553 * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
554 * options that most closely mimics the behavior of the clang compiler.
555 *
556 * \param Diagnostic The diagnostic to print.
557 *
558 * \param Options A set of options that control the diagnostic display,
559 * created by combining \c CXDiagnosticDisplayOptions values.
560 *
561 * \returns A new string containing for formatted diagnostic.
562 */
563CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
564                                               unsigned Options);
565
566/**
567 * \brief Retrieve the set of display options most similar to the
568 * default behavior of the clang compiler.
569 *
570 * \returns A set of display options suitable for use with \c
571 * clang_displayDiagnostic().
572 */
573CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
574
575/**
576 * \brief Determine the severity of the given diagnostic.
577 */
578CINDEX_LINKAGE enum CXDiagnosticSeverity
579clang_getDiagnosticSeverity(CXDiagnostic);
580
581/**
582 * \brief Retrieve the source location of the given diagnostic.
583 *
584 * This location is where Clang would print the caret ('^') when
585 * displaying the diagnostic on the command line.
586 */
587CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
588
589/**
590 * \brief Retrieve the text of the given diagnostic.
591 */
592CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
593
594/**
595 * \brief Retrieve the name of the command-line option that enabled this
596 * diagnostic.
597 *
598 * \param Diag The diagnostic to be queried.
599 *
600 * \param Disable If non-NULL, will be set to the option that disables this
601 * diagnostic (if any).
602 *
603 * \returns A string that contains the command-line option used to enable this
604 * warning, such as "-Wconversion" or "-pedantic".
605 */
606CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
607                                                  CXString *Disable);
608
609/**
610 * \brief Retrieve the category number for this diagnostic.
611 *
612 * Diagnostics can be categorized into groups along with other, related
613 * diagnostics (e.g., diagnostics under the same warning flag). This routine
614 * retrieves the category number for the given diagnostic.
615 *
616 * \returns The number of the category that contains this diagnostic, or zero
617 * if this diagnostic is uncategorized.
618 */
619CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
620
621/**
622 * \brief Retrieve the name of a particular diagnostic category.
623 *
624 * \param Category A diagnostic category number, as returned by
625 * \c clang_getDiagnosticCategory().
626 *
627 * \returns The name of the given diagnostic category.
628 */
629CINDEX_LINKAGE CXString clang_getDiagnosticCategoryName(unsigned Category);
630
631/**
632 * \brief Determine the number of source ranges associated with the given
633 * diagnostic.
634 */
635CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
636
637/**
638 * \brief Retrieve a source range associated with the diagnostic.
639 *
640 * A diagnostic's source ranges highlight important elements in the source
641 * code. On the command line, Clang displays source ranges by
642 * underlining them with '~' characters.
643 *
644 * \param Diagnostic the diagnostic whose range is being extracted.
645 *
646 * \param Range the zero-based index specifying which range to
647 *
648 * \returns the requested source range.
649 */
650CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
651                                                      unsigned Range);
652
653/**
654 * \brief Determine the number of fix-it hints associated with the
655 * given diagnostic.
656 */
657CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
658
659/**
660 * \brief Retrieve the replacement information for a given fix-it.
661 *
662 * Fix-its are described in terms of a source range whose contents
663 * should be replaced by a string. This approach generalizes over
664 * three kinds of operations: removal of source code (the range covers
665 * the code to be removed and the replacement string is empty),
666 * replacement of source code (the range covers the code to be
667 * replaced and the replacement string provides the new code), and
668 * insertion (both the start and end of the range point at the
669 * insertion location, and the replacement string provides the text to
670 * insert).
671 *
672 * \param Diagnostic The diagnostic whose fix-its are being queried.
673 *
674 * \param FixIt The zero-based index of the fix-it.
675 *
676 * \param ReplacementRange The source range whose contents will be
677 * replaced with the returned replacement string. Note that source
678 * ranges are half-open ranges [a, b), so the source code should be
679 * replaced from a and up to (but not including) b.
680 *
681 * \returns A string containing text that should be replace the source
682 * code indicated by the \c ReplacementRange.
683 */
684CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(CXDiagnostic Diagnostic,
685                                                 unsigned FixIt,
686                                               CXSourceRange *ReplacementRange);
687
688/**
689 * @}
690 */
691
692/**
693 * \defgroup CINDEX_TRANSLATION_UNIT Translation unit manipulation
694 *
695 * The routines in this group provide the ability to create and destroy
696 * translation units from files, either by parsing the contents of the files or
697 * by reading in a serialized representation of a translation unit.
698 *
699 * @{
700 */
701
702/**
703 * \brief Get the original translation unit source file name.
704 */
705CINDEX_LINKAGE CXString
706clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit);
707
708/**
709 * \brief Return the CXTranslationUnit for a given source file and the provided
710 * command line arguments one would pass to the compiler.
711 *
712 * Note: The 'source_filename' argument is optional.  If the caller provides a
713 * NULL pointer, the name of the source file is expected to reside in the
714 * specified command line arguments.
715 *
716 * Note: When encountered in 'clang_command_line_args', the following options
717 * are ignored:
718 *
719 *   '-c'
720 *   '-emit-ast'
721 *   '-fsyntax-only'
722 *   '-o <output file>'  (both '-o' and '<output file>' are ignored)
723 *
724 * \param CIdx The index object with which the translation unit will be
725 * associated.
726 *
727 * \param source_filename - The name of the source file to load, or NULL if the
728 * source file is included in \p clang_command_line_args.
729 *
730 * \param num_clang_command_line_args The number of command-line arguments in
731 * \p clang_command_line_args.
732 *
733 * \param clang_command_line_args The command-line arguments that would be
734 * passed to the \c clang executable if it were being invoked out-of-process.
735 * These command-line options will be parsed and will affect how the translation
736 * unit is parsed. Note that the following options are ignored: '-c',
737 * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
738 *
739 * \param num_unsaved_files the number of unsaved file entries in \p
740 * unsaved_files.
741 *
742 * \param unsaved_files the files that have not yet been saved to disk
743 * but may be required for code completion, including the contents of
744 * those files.  The contents and name of these files (as specified by
745 * CXUnsavedFile) are copied when necessary, so the client only needs to
746 * guarantee their validity until the call to this function returns.
747 */
748CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnitFromSourceFile(
749                                         CXIndex CIdx,
750                                         const char *source_filename,
751                                         int num_clang_command_line_args,
752                                   const char * const *clang_command_line_args,
753                                         unsigned num_unsaved_files,
754                                         struct CXUnsavedFile *unsaved_files);
755
756/**
757 * \brief Create a translation unit from an AST file (-emit-ast).
758 */
759CINDEX_LINKAGE CXTranslationUnit clang_createTranslationUnit(CXIndex,
760                                             const char *ast_filename);
761
762/**
763 * \brief Flags that control the creation of translation units.
764 *
765 * The enumerators in this enumeration type are meant to be bitwise
766 * ORed together to specify which options should be used when
767 * constructing the translation unit.
768 */
769enum CXTranslationUnit_Flags {
770  /**
771   * \brief Used to indicate that no special translation-unit options are
772   * needed.
773   */
774  CXTranslationUnit_None = 0x0,
775
776  /**
777   * \brief Used to indicate that the parser should construct a "detailed"
778   * preprocessing record, including all macro definitions and instantiations.
779   *
780   * Constructing a detailed preprocessing record requires more memory
781   * and time to parse, since the information contained in the record
782   * is usually not retained. However, it can be useful for
783   * applications that require more detailed information about the
784   * behavior of the preprocessor.
785   */
786  CXTranslationUnit_DetailedPreprocessingRecord = 0x01,
787
788  /**
789   * \brief Used to indicate that the translation unit is incomplete.
790   *
791   * When a translation unit is considered "incomplete", semantic
792   * analysis that is typically performed at the end of the
793   * translation unit will be suppressed. For example, this suppresses
794   * the completion of tentative declarations in C and of
795   * instantiation of implicitly-instantiation function templates in
796   * C++. This option is typically used when parsing a header with the
797   * intent of producing a precompiled header.
798   */
799  CXTranslationUnit_Incomplete = 0x02,
800
801  /**
802   * \brief Used to indicate that the translation unit should be built with an
803   * implicit precompiled header for the preamble.
804   *
805   * An implicit precompiled header is used as an optimization when a
806   * particular translation unit is likely to be reparsed many times
807   * when the sources aren't changing that often. In this case, an
808   * implicit precompiled header will be built containing all of the
809   * initial includes at the top of the main file (what we refer to as
810   * the "preamble" of the file). In subsequent parses, if the
811   * preamble or the files in it have not changed, \c
812   * clang_reparseTranslationUnit() will re-use the implicit
813   * precompiled header to improve parsing performance.
814   */
815  CXTranslationUnit_PrecompiledPreamble = 0x04,
816
817  /**
818   * \brief Used to indicate that the translation unit should cache some
819   * code-completion results with each reparse of the source file.
820   *
821   * Caching of code-completion results is a performance optimization that
822   * introduces some overhead to reparsing but improves the performance of
823   * code-completion operations.
824   */
825  CXTranslationUnit_CacheCompletionResults = 0x08,
826  /**
827   * \brief Enable precompiled preambles in C++.
828   *
829   * Note: this is a *temporary* option that is available only while
830   * we are testing C++ precompiled preamble support.
831   */
832  CXTranslationUnit_CXXPrecompiledPreamble = 0x10,
833
834  /**
835   * \brief Enabled chained precompiled preambles in C++.
836   *
837   * Note: this is a *temporary* option that is available only while
838   * we are testing C++ precompiled preamble support.
839   */
840  CXTranslationUnit_CXXChainedPCH = 0x20,
841
842  /**
843   * \brief Used to indicate that the "detailed" preprocessing record,
844   * if requested, should also contain nested macro expansions.
845   *
846   * Nested macro expansions (i.e., macro expansions that occur
847   * inside another macro expansion) can, in some code bases, require
848   * a large amount of storage to due preprocessor metaprogramming. Moreover,
849   * its fairly rare that this information is useful for libclang clients.
850   */
851  CXTranslationUnit_NestedMacroExpansions = 0x40,
852
853  /**
854   * \brief Legacy name to indicate that the "detailed" preprocessing record,
855   * if requested, should contain nested macro expansions.
856   *
857   * \see CXTranslationUnit_NestedMacroExpansions for the current name for this
858   * value, and its semantics. This is just an alias.
859   */
860  CXTranslationUnit_NestedMacroInstantiations =
861    CXTranslationUnit_NestedMacroExpansions
862};
863
864/**
865 * \brief Returns the set of flags that is suitable for parsing a translation
866 * unit that is being edited.
867 *
868 * The set of flags returned provide options for \c clang_parseTranslationUnit()
869 * to indicate that the translation unit is likely to be reparsed many times,
870 * either explicitly (via \c clang_reparseTranslationUnit()) or implicitly
871 * (e.g., by code completion (\c clang_codeCompletionAt())). The returned flag
872 * set contains an unspecified set of optimizations (e.g., the precompiled
873 * preamble) geared toward improving the performance of these routines. The
874 * set of optimizations enabled may change from one version to the next.
875 */
876CINDEX_LINKAGE unsigned clang_defaultEditingTranslationUnitOptions(void);
877
878/**
879 * \brief Parse the given source file and the translation unit corresponding
880 * to that file.
881 *
882 * This routine is the main entry point for the Clang C API, providing the
883 * ability to parse a source file into a translation unit that can then be
884 * queried by other functions in the API. This routine accepts a set of
885 * command-line arguments so that the compilation can be configured in the same
886 * way that the compiler is configured on the command line.
887 *
888 * \param CIdx The index object with which the translation unit will be
889 * associated.
890 *
891 * \param source_filename The name of the source file to load, or NULL if the
892 * source file is included in \p command_line_args.
893 *
894 * \param command_line_args The command-line arguments that would be
895 * passed to the \c clang executable if it were being invoked out-of-process.
896 * These command-line options will be parsed and will affect how the translation
897 * unit is parsed. Note that the following options are ignored: '-c',
898 * '-emit-ast', '-fsyntex-only' (which is the default), and '-o <output file>'.
899 *
900 * \param num_command_line_args The number of command-line arguments in
901 * \p command_line_args.
902 *
903 * \param unsaved_files the files that have not yet been saved to disk
904 * but may be required for parsing, including the contents of
905 * those files.  The contents and name of these files (as specified by
906 * CXUnsavedFile) are copied when necessary, so the client only needs to
907 * guarantee their validity until the call to this function returns.
908 *
909 * \param num_unsaved_files the number of unsaved file entries in \p
910 * unsaved_files.
911 *
912 * \param options A bitmask of options that affects how the translation unit
913 * is managed but not its compilation. This should be a bitwise OR of the
914 * CXTranslationUnit_XXX flags.
915 *
916 * \returns A new translation unit describing the parsed code and containing
917 * any diagnostics produced by the compiler. If there is a failure from which
918 * the compiler cannot recover, returns NULL.
919 */
920CINDEX_LINKAGE CXTranslationUnit clang_parseTranslationUnit(CXIndex CIdx,
921                                                    const char *source_filename,
922                                         const char * const *command_line_args,
923                                                      int num_command_line_args,
924                                            struct CXUnsavedFile *unsaved_files,
925                                                     unsigned num_unsaved_files,
926                                                            unsigned options);
927
928/**
929 * \brief Flags that control how translation units are saved.
930 *
931 * The enumerators in this enumeration type are meant to be bitwise
932 * ORed together to specify which options should be used when
933 * saving the translation unit.
934 */
935enum CXSaveTranslationUnit_Flags {
936  /**
937   * \brief Used to indicate that no special saving options are needed.
938   */
939  CXSaveTranslationUnit_None = 0x0
940};
941
942/**
943 * \brief Returns the set of flags that is suitable for saving a translation
944 * unit.
945 *
946 * The set of flags returned provide options for
947 * \c clang_saveTranslationUnit() by default. The returned flag
948 * set contains an unspecified set of options that save translation units with
949 * the most commonly-requested data.
950 */
951CINDEX_LINKAGE unsigned clang_defaultSaveOptions(CXTranslationUnit TU);
952
953/**
954 * \brief Describes the kind of error that occurred (if any) in a call to
955 * \c clang_saveTranslationUnit().
956 */
957enum CXSaveError {
958  /**
959   * \brief Indicates that no error occurred while saving a translation unit.
960   */
961  CXSaveError_None = 0,
962
963  /**
964   * \brief Indicates that an unknown error occurred while attempting to save
965   * the file.
966   *
967   * This error typically indicates that file I/O failed when attempting to
968   * write the file.
969   */
970  CXSaveError_Unknown = 1,
971
972  /**
973   * \brief Indicates that errors during translation prevented this attempt
974   * to save the translation unit.
975   *
976   * Errors that prevent the translation unit from being saved can be
977   * extracted using \c clang_getNumDiagnostics() and \c clang_getDiagnostic().
978   */
979  CXSaveError_TranslationErrors = 2,
980
981  /**
982   * \brief Indicates that the translation unit to be saved was somehow
983   * invalid (e.g., NULL).
984   */
985  CXSaveError_InvalidTU = 3
986};
987
988/**
989 * \brief Saves a translation unit into a serialized representation of
990 * that translation unit on disk.
991 *
992 * Any translation unit that was parsed without error can be saved
993 * into a file. The translation unit can then be deserialized into a
994 * new \c CXTranslationUnit with \c clang_createTranslationUnit() or,
995 * if it is an incomplete translation unit that corresponds to a
996 * header, used as a precompiled header when parsing other translation
997 * units.
998 *
999 * \param TU The translation unit to save.
1000 *
1001 * \param FileName The file to which the translation unit will be saved.
1002 *
1003 * \param options A bitmask of options that affects how the translation unit
1004 * is saved. This should be a bitwise OR of the
1005 * CXSaveTranslationUnit_XXX flags.
1006 *
1007 * \returns A value that will match one of the enumerators of the CXSaveError
1008 * enumeration. Zero (CXSaveError_None) indicates that the translation unit was
1009 * saved successfully, while a non-zero value indicates that a problem occurred.
1010 */
1011CINDEX_LINKAGE int clang_saveTranslationUnit(CXTranslationUnit TU,
1012                                             const char *FileName,
1013                                             unsigned options);
1014
1015/**
1016 * \brief Destroy the specified CXTranslationUnit object.
1017 */
1018CINDEX_LINKAGE void clang_disposeTranslationUnit(CXTranslationUnit);
1019
1020/**
1021 * \brief Flags that control the reparsing of translation units.
1022 *
1023 * The enumerators in this enumeration type are meant to be bitwise
1024 * ORed together to specify which options should be used when
1025 * reparsing the translation unit.
1026 */
1027enum CXReparse_Flags {
1028  /**
1029   * \brief Used to indicate that no special reparsing options are needed.
1030   */
1031  CXReparse_None = 0x0
1032};
1033
1034/**
1035 * \brief Returns the set of flags that is suitable for reparsing a translation
1036 * unit.
1037 *
1038 * The set of flags returned provide options for
1039 * \c clang_reparseTranslationUnit() by default. The returned flag
1040 * set contains an unspecified set of optimizations geared toward common uses
1041 * of reparsing. The set of optimizations enabled may change from one version
1042 * to the next.
1043 */
1044CINDEX_LINKAGE unsigned clang_defaultReparseOptions(CXTranslationUnit TU);
1045
1046/**
1047 * \brief Reparse the source files that produced this translation unit.
1048 *
1049 * This routine can be used to re-parse the source files that originally
1050 * created the given translation unit, for example because those source files
1051 * have changed (either on disk or as passed via \p unsaved_files). The
1052 * source code will be reparsed with the same command-line options as it
1053 * was originally parsed.
1054 *
1055 * Reparsing a translation unit invalidates all cursors and source locations
1056 * that refer into that translation unit. This makes reparsing a translation
1057 * unit semantically equivalent to destroying the translation unit and then
1058 * creating a new translation unit with the same command-line arguments.
1059 * However, it may be more efficient to reparse a translation
1060 * unit using this routine.
1061 *
1062 * \param TU The translation unit whose contents will be re-parsed. The
1063 * translation unit must originally have been built with
1064 * \c clang_createTranslationUnitFromSourceFile().
1065 *
1066 * \param num_unsaved_files The number of unsaved file entries in \p
1067 * unsaved_files.
1068 *
1069 * \param unsaved_files The files that have not yet been saved to disk
1070 * but may be required for parsing, including the contents of
1071 * those files.  The contents and name of these files (as specified by
1072 * CXUnsavedFile) are copied when necessary, so the client only needs to
1073 * guarantee their validity until the call to this function returns.
1074 *
1075 * \param options A bitset of options composed of the flags in CXReparse_Flags.
1076 * The function \c clang_defaultReparseOptions() produces a default set of
1077 * options recommended for most uses, based on the translation unit.
1078 *
1079 * \returns 0 if the sources could be reparsed. A non-zero value will be
1080 * returned if reparsing was impossible, such that the translation unit is
1081 * invalid. In such cases, the only valid call for \p TU is
1082 * \c clang_disposeTranslationUnit(TU).
1083 */
1084CINDEX_LINKAGE int clang_reparseTranslationUnit(CXTranslationUnit TU,
1085                                                unsigned num_unsaved_files,
1086                                          struct CXUnsavedFile *unsaved_files,
1087                                                unsigned options);
1088
1089/**
1090  * \brief Categorizes how memory is being used by a translation unit.
1091  */
1092enum CXTUResourceUsageKind {
1093  CXTUResourceUsage_AST = 1,
1094  CXTUResourceUsage_Identifiers = 2,
1095  CXTUResourceUsage_Selectors = 3,
1096  CXTUResourceUsage_GlobalCompletionResults = 4,
1097  CXTUResourceUsage_SourceManagerContentCache = 5,
1098  CXTUResourceUsage_AST_SideTables = 6,
1099  CXTUResourceUsage_SourceManager_Membuffer_Malloc = 7,
1100  CXTUResourceUsage_SourceManager_Membuffer_MMap = 8,
1101  CXTUResourceUsage_ExternalASTSource_Membuffer_Malloc = 9,
1102  CXTUResourceUsage_ExternalASTSource_Membuffer_MMap = 10,
1103  CXTUResourceUsage_Preprocessor = 11,
1104  CXTUResourceUsage_PreprocessingRecord = 12,
1105  CXTUResourceUsage_SourceManager_DataStructures = 13,
1106  CXTUResourceUsage_Preprocessor_HeaderSearch = 14,
1107  CXTUResourceUsage_MEMORY_IN_BYTES_BEGIN = CXTUResourceUsage_AST,
1108  CXTUResourceUsage_MEMORY_IN_BYTES_END =
1109    CXTUResourceUsage_Preprocessor_HeaderSearch,
1110
1111  CXTUResourceUsage_First = CXTUResourceUsage_AST,
1112  CXTUResourceUsage_Last = CXTUResourceUsage_Preprocessor_HeaderSearch
1113};
1114
1115/**
1116  * \brief Returns the human-readable null-terminated C string that represents
1117  *  the name of the memory category.  This string should never be freed.
1118  */
1119CINDEX_LINKAGE
1120const char *clang_getTUResourceUsageName(enum CXTUResourceUsageKind kind);
1121
1122typedef struct CXTUResourceUsageEntry {
1123  /* \brief The memory usage category. */
1124  enum CXTUResourceUsageKind kind;
1125  /* \brief Amount of resources used.
1126      The units will depend on the resource kind. */
1127  unsigned long amount;
1128} CXTUResourceUsageEntry;
1129
1130/**
1131  * \brief The memory usage of a CXTranslationUnit, broken into categories.
1132  */
1133typedef struct CXTUResourceUsage {
1134  /* \brief Private data member, used for queries. */
1135  void *data;
1136
1137  /* \brief The number of entries in the 'entries' array. */
1138  unsigned numEntries;
1139
1140  /* \brief An array of key-value pairs, representing the breakdown of memory
1141            usage. */
1142  CXTUResourceUsageEntry *entries;
1143
1144} CXTUResourceUsage;
1145
1146/**
1147  * \brief Return the memory usage of a translation unit.  This object
1148  *  should be released with clang_disposeCXTUResourceUsage().
1149  */
1150CINDEX_LINKAGE CXTUResourceUsage clang_getCXTUResourceUsage(CXTranslationUnit TU);
1151
1152CINDEX_LINKAGE void clang_disposeCXTUResourceUsage(CXTUResourceUsage usage);
1153
1154/**
1155 * @}
1156 */
1157
1158/**
1159 * \brief Describes the kind of entity that a cursor refers to.
1160 */
1161enum CXCursorKind {
1162  /* Declarations */
1163  /**
1164   * \brief A declaration whose specific kind is not exposed via this
1165   * interface.
1166   *
1167   * Unexposed declarations have the same operations as any other kind
1168   * of declaration; one can extract their location information,
1169   * spelling, find their definitions, etc. However, the specific kind
1170   * of the declaration is not reported.
1171   */
1172  CXCursor_UnexposedDecl                 = 1,
1173  /** \brief A C or C++ struct. */
1174  CXCursor_StructDecl                    = 2,
1175  /** \brief A C or C++ union. */
1176  CXCursor_UnionDecl                     = 3,
1177  /** \brief A C++ class. */
1178  CXCursor_ClassDecl                     = 4,
1179  /** \brief An enumeration. */
1180  CXCursor_EnumDecl                      = 5,
1181  /**
1182   * \brief A field (in C) or non-static data member (in C++) in a
1183   * struct, union, or C++ class.
1184   */
1185  CXCursor_FieldDecl                     = 6,
1186  /** \brief An enumerator constant. */
1187  CXCursor_EnumConstantDecl              = 7,
1188  /** \brief A function. */
1189  CXCursor_FunctionDecl                  = 8,
1190  /** \brief A variable. */
1191  CXCursor_VarDecl                       = 9,
1192  /** \brief A function or method parameter. */
1193  CXCursor_ParmDecl                      = 10,
1194  /** \brief An Objective-C @interface. */
1195  CXCursor_ObjCInterfaceDecl             = 11,
1196  /** \brief An Objective-C @interface for a category. */
1197  CXCursor_ObjCCategoryDecl              = 12,
1198  /** \brief An Objective-C @protocol declaration. */
1199  CXCursor_ObjCProtocolDecl              = 13,
1200  /** \brief An Objective-C @property declaration. */
1201  CXCursor_ObjCPropertyDecl              = 14,
1202  /** \brief An Objective-C instance variable. */
1203  CXCursor_ObjCIvarDecl                  = 15,
1204  /** \brief An Objective-C instance method. */
1205  CXCursor_ObjCInstanceMethodDecl        = 16,
1206  /** \brief An Objective-C class method. */
1207  CXCursor_ObjCClassMethodDecl           = 17,
1208  /** \brief An Objective-C @implementation. */
1209  CXCursor_ObjCImplementationDecl        = 18,
1210  /** \brief An Objective-C @implementation for a category. */
1211  CXCursor_ObjCCategoryImplDecl          = 19,
1212  /** \brief A typedef */
1213  CXCursor_TypedefDecl                   = 20,
1214  /** \brief A C++ class method. */
1215  CXCursor_CXXMethod                     = 21,
1216  /** \brief A C++ namespace. */
1217  CXCursor_Namespace                     = 22,
1218  /** \brief A linkage specification, e.g. 'extern "C"'. */
1219  CXCursor_LinkageSpec                   = 23,
1220  /** \brief A C++ constructor. */
1221  CXCursor_Constructor                   = 24,
1222  /** \brief A C++ destructor. */
1223  CXCursor_Destructor                    = 25,
1224  /** \brief A C++ conversion function. */
1225  CXCursor_ConversionFunction            = 26,
1226  /** \brief A C++ template type parameter. */
1227  CXCursor_TemplateTypeParameter         = 27,
1228  /** \brief A C++ non-type template parameter. */
1229  CXCursor_NonTypeTemplateParameter      = 28,
1230  /** \brief A C++ template template parameter. */
1231  CXCursor_TemplateTemplateParameter     = 29,
1232  /** \brief A C++ function template. */
1233  CXCursor_FunctionTemplate              = 30,
1234  /** \brief A C++ class template. */
1235  CXCursor_ClassTemplate                 = 31,
1236  /** \brief A C++ class template partial specialization. */
1237  CXCursor_ClassTemplatePartialSpecialization = 32,
1238  /** \brief A C++ namespace alias declaration. */
1239  CXCursor_NamespaceAlias                = 33,
1240  /** \brief A C++ using directive. */
1241  CXCursor_UsingDirective                = 34,
1242  /** \brief A C++ using declaration. */
1243  CXCursor_UsingDeclaration              = 35,
1244  /** \brief A C++ alias declaration */
1245  CXCursor_TypeAliasDecl                 = 36,
1246  /** \brief An Objective-C @synthesize definition. */
1247  CXCursor_ObjCSynthesizeDecl            = 37,
1248  /** \brief An Objective-C @dynamic definition. */
1249  CXCursor_ObjCDynamicDecl               = 38,
1250  CXCursor_FirstDecl                     = CXCursor_UnexposedDecl,
1251  CXCursor_LastDecl                      = CXCursor_ObjCDynamicDecl,
1252
1253  /* References */
1254  CXCursor_FirstRef                      = 40, /* Decl references */
1255  CXCursor_ObjCSuperClassRef             = 40,
1256  CXCursor_ObjCProtocolRef               = 41,
1257  CXCursor_ObjCClassRef                  = 42,
1258  /**
1259   * \brief A reference to a type declaration.
1260   *
1261   * A type reference occurs anywhere where a type is named but not
1262   * declared. For example, given:
1263   *
1264   * \code
1265   * typedef unsigned size_type;
1266   * size_type size;
1267   * \endcode
1268   *
1269   * The typedef is a declaration of size_type (CXCursor_TypedefDecl),
1270   * while the type of the variable "size" is referenced. The cursor
1271   * referenced by the type of size is the typedef for size_type.
1272   */
1273  CXCursor_TypeRef                       = 43,
1274  CXCursor_CXXBaseSpecifier              = 44,
1275  /**
1276   * \brief A reference to a class template, function template, template
1277   * template parameter, or class template partial specialization.
1278   */
1279  CXCursor_TemplateRef                   = 45,
1280  /**
1281   * \brief A reference to a namespace or namespace alias.
1282   */
1283  CXCursor_NamespaceRef                  = 46,
1284  /**
1285   * \brief A reference to a member of a struct, union, or class that occurs in
1286   * some non-expression context, e.g., a designated initializer.
1287   */
1288  CXCursor_MemberRef                     = 47,
1289  /**
1290   * \brief A reference to a labeled statement.
1291   *
1292   * This cursor kind is used to describe the jump to "start_over" in the
1293   * goto statement in the following example:
1294   *
1295   * \code
1296   *   start_over:
1297   *     ++counter;
1298   *
1299   *     goto start_over;
1300   * \endcode
1301   *
1302   * A label reference cursor refers to a label statement.
1303   */
1304  CXCursor_LabelRef                      = 48,
1305
1306  /**
1307   * \brief A reference to a set of overloaded functions or function templates
1308   * that has not yet been resolved to a specific function or function template.
1309   *
1310   * An overloaded declaration reference cursor occurs in C++ templates where
1311   * a dependent name refers to a function. For example:
1312   *
1313   * \code
1314   * template<typename T> void swap(T&, T&);
1315   *
1316   * struct X { ... };
1317   * void swap(X&, X&);
1318   *
1319   * template<typename T>
1320   * void reverse(T* first, T* last) {
1321   *   while (first < last - 1) {
1322   *     swap(*first, *--last);
1323   *     ++first;
1324   *   }
1325   * }
1326   *
1327   * struct Y { };
1328   * void swap(Y&, Y&);
1329   * \endcode
1330   *
1331   * Here, the identifier "swap" is associated with an overloaded declaration
1332   * reference. In the template definition, "swap" refers to either of the two
1333   * "swap" functions declared above, so both results will be available. At
1334   * instantiation time, "swap" may also refer to other functions found via
1335   * argument-dependent lookup (e.g., the "swap" function at the end of the
1336   * example).
1337   *
1338   * The functions \c clang_getNumOverloadedDecls() and
1339   * \c clang_getOverloadedDecl() can be used to retrieve the definitions
1340   * referenced by this cursor.
1341   */
1342  CXCursor_OverloadedDeclRef             = 49,
1343
1344  CXCursor_LastRef                       = CXCursor_OverloadedDeclRef,
1345
1346  /* Error conditions */
1347  CXCursor_FirstInvalid                  = 70,
1348  CXCursor_InvalidFile                   = 70,
1349  CXCursor_NoDeclFound                   = 71,
1350  CXCursor_NotImplemented                = 72,
1351  CXCursor_InvalidCode                   = 73,
1352  CXCursor_LastInvalid                   = CXCursor_InvalidCode,
1353
1354  /* Expressions */
1355  CXCursor_FirstExpr                     = 100,
1356
1357  /**
1358   * \brief An expression whose specific kind is not exposed via this
1359   * interface.
1360   *
1361   * Unexposed expressions have the same operations as any other kind
1362   * of expression; one can extract their location information,
1363   * spelling, children, etc. However, the specific kind of the
1364   * expression is not reported.
1365   */
1366  CXCursor_UnexposedExpr                 = 100,
1367
1368  /**
1369   * \brief An expression that refers to some value declaration, such
1370   * as a function, varible, or enumerator.
1371   */
1372  CXCursor_DeclRefExpr                   = 101,
1373
1374  /**
1375   * \brief An expression that refers to a member of a struct, union,
1376   * class, Objective-C class, etc.
1377   */
1378  CXCursor_MemberRefExpr                 = 102,
1379
1380  /** \brief An expression that calls a function. */
1381  CXCursor_CallExpr                      = 103,
1382
1383  /** \brief An expression that sends a message to an Objective-C
1384   object or class. */
1385  CXCursor_ObjCMessageExpr               = 104,
1386
1387  /** \brief An expression that represents a block literal. */
1388  CXCursor_BlockExpr                     = 105,
1389
1390  CXCursor_LastExpr                      = 105,
1391
1392  /* Statements */
1393  CXCursor_FirstStmt                     = 200,
1394  /**
1395   * \brief A statement whose specific kind is not exposed via this
1396   * interface.
1397   *
1398   * Unexposed statements have the same operations as any other kind of
1399   * statement; one can extract their location information, spelling,
1400   * children, etc. However, the specific kind of the statement is not
1401   * reported.
1402   */
1403  CXCursor_UnexposedStmt                 = 200,
1404
1405  /** \brief A labelled statement in a function.
1406   *
1407   * This cursor kind is used to describe the "start_over:" label statement in
1408   * the following example:
1409   *
1410   * \code
1411   *   start_over:
1412   *     ++counter;
1413   * \endcode
1414   *
1415   */
1416  CXCursor_LabelStmt                     = 201,
1417
1418  CXCursor_LastStmt                      = CXCursor_LabelStmt,
1419
1420  /**
1421   * \brief Cursor that represents the translation unit itself.
1422   *
1423   * The translation unit cursor exists primarily to act as the root
1424   * cursor for traversing the contents of a translation unit.
1425   */
1426  CXCursor_TranslationUnit               = 300,
1427
1428  /* Attributes */
1429  CXCursor_FirstAttr                     = 400,
1430  /**
1431   * \brief An attribute whose specific kind is not exposed via this
1432   * interface.
1433   */
1434  CXCursor_UnexposedAttr                 = 400,
1435
1436  CXCursor_IBActionAttr                  = 401,
1437  CXCursor_IBOutletAttr                  = 402,
1438  CXCursor_IBOutletCollectionAttr        = 403,
1439  CXCursor_LastAttr                      = CXCursor_IBOutletCollectionAttr,
1440
1441  /* Preprocessing */
1442  CXCursor_PreprocessingDirective        = 500,
1443  CXCursor_MacroDefinition               = 501,
1444  CXCursor_MacroExpansion                = 502,
1445  CXCursor_MacroInstantiation            = CXCursor_MacroExpansion,
1446  CXCursor_InclusionDirective            = 503,
1447  CXCursor_FirstPreprocessing            = CXCursor_PreprocessingDirective,
1448  CXCursor_LastPreprocessing             = CXCursor_InclusionDirective
1449};
1450
1451/**
1452 * \brief A cursor representing some element in the abstract syntax tree for
1453 * a translation unit.
1454 *
1455 * The cursor abstraction unifies the different kinds of entities in a
1456 * program--declaration, statements, expressions, references to declarations,
1457 * etc.--under a single "cursor" abstraction with a common set of operations.
1458 * Common operation for a cursor include: getting the physical location in
1459 * a source file where the cursor points, getting the name associated with a
1460 * cursor, and retrieving cursors for any child nodes of a particular cursor.
1461 *
1462 * Cursors can be produced in two specific ways.
1463 * clang_getTranslationUnitCursor() produces a cursor for a translation unit,
1464 * from which one can use clang_visitChildren() to explore the rest of the
1465 * translation unit. clang_getCursor() maps from a physical source location
1466 * to the entity that resides at that location, allowing one to map from the
1467 * source code into the AST.
1468 */
1469typedef struct {
1470  enum CXCursorKind kind;
1471  void *data[3];
1472} CXCursor;
1473
1474/**
1475 * \defgroup CINDEX_CURSOR_MANIP Cursor manipulations
1476 *
1477 * @{
1478 */
1479
1480/**
1481 * \brief Retrieve the NULL cursor, which represents no entity.
1482 */
1483CINDEX_LINKAGE CXCursor clang_getNullCursor(void);
1484
1485/**
1486 * \brief Retrieve the cursor that represents the given translation unit.
1487 *
1488 * The translation unit cursor can be used to start traversing the
1489 * various declarations within the given translation unit.
1490 */
1491CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
1492
1493/**
1494 * \brief Determine whether two cursors are equivalent.
1495 */
1496CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
1497
1498/**
1499 * \brief Compute a hash value for the given cursor.
1500 */
1501CINDEX_LINKAGE unsigned clang_hashCursor(CXCursor);
1502
1503/**
1504 * \brief Retrieve the kind of the given cursor.
1505 */
1506CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
1507
1508/**
1509 * \brief Determine whether the given cursor kind represents a declaration.
1510 */
1511CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
1512
1513/**
1514 * \brief Determine whether the given cursor kind represents a simple
1515 * reference.
1516 *
1517 * Note that other kinds of cursors (such as expressions) can also refer to
1518 * other cursors. Use clang_getCursorReferenced() to determine whether a
1519 * particular cursor refers to another entity.
1520 */
1521CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
1522
1523/**
1524 * \brief Determine whether the given cursor kind represents an expression.
1525 */
1526CINDEX_LINKAGE unsigned clang_isExpression(enum CXCursorKind);
1527
1528/**
1529 * \brief Determine whether the given cursor kind represents a statement.
1530 */
1531CINDEX_LINKAGE unsigned clang_isStatement(enum CXCursorKind);
1532
1533/**
1534 * \brief Determine whether the given cursor kind represents an attribute.
1535 */
1536CINDEX_LINKAGE unsigned clang_isAttribute(enum CXCursorKind);
1537
1538/**
1539 * \brief Determine whether the given cursor kind represents an invalid
1540 * cursor.
1541 */
1542CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
1543
1544/**
1545 * \brief Determine whether the given cursor kind represents a translation
1546 * unit.
1547 */
1548CINDEX_LINKAGE unsigned clang_isTranslationUnit(enum CXCursorKind);
1549
1550/***
1551 * \brief Determine whether the given cursor represents a preprocessing
1552 * element, such as a preprocessor directive or macro instantiation.
1553 */
1554CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
1555
1556/***
1557 * \brief Determine whether the given cursor represents a currently
1558 *  unexposed piece of the AST (e.g., CXCursor_UnexposedStmt).
1559 */
1560CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
1561
1562/**
1563 * \brief Describe the linkage of the entity referred to by a cursor.
1564 */
1565enum CXLinkageKind {
1566  /** \brief This value indicates that no linkage information is available
1567   * for a provided CXCursor. */
1568  CXLinkage_Invalid,
1569  /**
1570   * \brief This is the linkage for variables, parameters, and so on that
1571   *  have automatic storage.  This covers normal (non-extern) local variables.
1572   */
1573  CXLinkage_NoLinkage,
1574  /** \brief This is the linkage for static variables and static functions. */
1575  CXLinkage_Internal,
1576  /** \brief This is the linkage for entities with external linkage that live
1577   * in C++ anonymous namespaces.*/
1578  CXLinkage_UniqueExternal,
1579  /** \brief This is the linkage for entities with true, external linkage. */
1580  CXLinkage_External
1581};
1582
1583/**
1584 * \brief Determine the linkage of the entity referred to by a given cursor.
1585 */
1586CINDEX_LINKAGE enum CXLinkageKind clang_getCursorLinkage(CXCursor cursor);
1587
1588/**
1589 * \brief Determine the availability of the entity that this cursor refers to.
1590 *
1591 * \param cursor The cursor to query.
1592 *
1593 * \returns The availability of the cursor.
1594 */
1595CINDEX_LINKAGE enum CXAvailabilityKind
1596clang_getCursorAvailability(CXCursor cursor);
1597
1598/**
1599 * \brief Describe the "language" of the entity referred to by a cursor.
1600 */
1601CINDEX_LINKAGE enum CXLanguageKind {
1602  CXLanguage_Invalid = 0,
1603  CXLanguage_C,
1604  CXLanguage_ObjC,
1605  CXLanguage_CPlusPlus
1606};
1607
1608/**
1609 * \brief Determine the "language" of the entity referred to by a given cursor.
1610 */
1611CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
1612
1613
1614/**
1615 * \brief A fast container representing a set of CXCursors.
1616 */
1617typedef struct CXCursorSetImpl *CXCursorSet;
1618
1619/**
1620 * \brief Creates an empty CXCursorSet.
1621 */
1622CINDEX_LINKAGE CXCursorSet clang_createCXCursorSet();
1623
1624/**
1625 * \brief Disposes a CXCursorSet and releases its associated memory.
1626 */
1627CINDEX_LINKAGE void clang_disposeCXCursorSet(CXCursorSet cset);
1628
1629/**
1630 * \brief Queries a CXCursorSet to see if it contains a specific CXCursor.
1631 *
1632 * \returns non-zero if the set contains the specified cursor.
1633*/
1634CINDEX_LINKAGE unsigned clang_CXCursorSet_contains(CXCursorSet cset,
1635                                                   CXCursor cursor);
1636
1637/**
1638 * \brief Inserts a CXCursor into a CXCursorSet.
1639 *
1640 * \returns zero if the CXCursor was already in the set, and non-zero otherwise.
1641*/
1642CINDEX_LINKAGE unsigned clang_CXCursorSet_insert(CXCursorSet cset,
1643                                                 CXCursor cursor);
1644
1645/**
1646 * \brief Determine the semantic parent of the given cursor.
1647 *
1648 * The semantic parent of a cursor is the cursor that semantically contains
1649 * the given \p cursor. For many declarations, the lexical and semantic parents
1650 * are equivalent (the lexical parent is returned by
1651 * \c clang_getCursorLexicalParent()). They diverge when declarations or
1652 * definitions are provided out-of-line. For example:
1653 *
1654 * \code
1655 * class C {
1656 *  void f();
1657 * };
1658 *
1659 * void C::f() { }
1660 * \endcode
1661 *
1662 * In the out-of-line definition of \c C::f, the semantic parent is the
1663 * the class \c C, of which this function is a member. The lexical parent is
1664 * the place where the declaration actually occurs in the source code; in this
1665 * case, the definition occurs in the translation unit. In general, the
1666 * lexical parent for a given entity can change without affecting the semantics
1667 * of the program, and the lexical parent of different declarations of the
1668 * same entity may be different. Changing the semantic parent of a declaration,
1669 * on the other hand, can have a major impact on semantics, and redeclarations
1670 * of a particular entity should all have the same semantic context.
1671 *
1672 * In the example above, both declarations of \c C::f have \c C as their
1673 * semantic context, while the lexical context of the first \c C::f is \c C
1674 * and the lexical context of the second \c C::f is the translation unit.
1675 *
1676 * For global declarations, the semantic parent is the translation unit.
1677 */
1678CINDEX_LINKAGE CXCursor clang_getCursorSemanticParent(CXCursor cursor);
1679
1680/**
1681 * \brief Determine the lexical parent of the given cursor.
1682 *
1683 * The lexical parent of a cursor is the cursor in which the given \p cursor
1684 * was actually written. For many declarations, the lexical and semantic parents
1685 * are equivalent (the semantic parent is returned by
1686 * \c clang_getCursorSemanticParent()). They diverge when declarations or
1687 * definitions are provided out-of-line. For example:
1688 *
1689 * \code
1690 * class C {
1691 *  void f();
1692 * };
1693 *
1694 * void C::f() { }
1695 * \endcode
1696 *
1697 * In the out-of-line definition of \c C::f, the semantic parent is the
1698 * the class \c C, of which this function is a member. The lexical parent is
1699 * the place where the declaration actually occurs in the source code; in this
1700 * case, the definition occurs in the translation unit. In general, the
1701 * lexical parent for a given entity can change without affecting the semantics
1702 * of the program, and the lexical parent of different declarations of the
1703 * same entity may be different. Changing the semantic parent of a declaration,
1704 * on the other hand, can have a major impact on semantics, and redeclarations
1705 * of a particular entity should all have the same semantic context.
1706 *
1707 * In the example above, both declarations of \c C::f have \c C as their
1708 * semantic context, while the lexical context of the first \c C::f is \c C
1709 * and the lexical context of the second \c C::f is the translation unit.
1710 *
1711 * For declarations written in the global scope, the lexical parent is
1712 * the translation unit.
1713 */
1714CINDEX_LINKAGE CXCursor clang_getCursorLexicalParent(CXCursor cursor);
1715
1716/**
1717 * \brief Determine the set of methods that are overridden by the given
1718 * method.
1719 *
1720 * In both Objective-C and C++, a method (aka virtual member function,
1721 * in C++) can override a virtual method in a base class. For
1722 * Objective-C, a method is said to override any method in the class's
1723 * interface (if we're coming from an implementation), its protocols,
1724 * or its categories, that has the same selector and is of the same
1725 * kind (class or instance). If no such method exists, the search
1726 * continues to the class's superclass, its protocols, and its
1727 * categories, and so on.
1728 *
1729 * For C++, a virtual member function overrides any virtual member
1730 * function with the same signature that occurs in its base
1731 * classes. With multiple inheritance, a virtual member function can
1732 * override several virtual member functions coming from different
1733 * base classes.
1734 *
1735 * In all cases, this function determines the immediate overridden
1736 * method, rather than all of the overridden methods. For example, if
1737 * a method is originally declared in a class A, then overridden in B
1738 * (which in inherits from A) and also in C (which inherited from B),
1739 * then the only overridden method returned from this function when
1740 * invoked on C's method will be B's method. The client may then
1741 * invoke this function again, given the previously-found overridden
1742 * methods, to map out the complete method-override set.
1743 *
1744 * \param cursor A cursor representing an Objective-C or C++
1745 * method. This routine will compute the set of methods that this
1746 * method overrides.
1747 *
1748 * \param overridden A pointer whose pointee will be replaced with a
1749 * pointer to an array of cursors, representing the set of overridden
1750 * methods. If there are no overridden methods, the pointee will be
1751 * set to NULL. The pointee must be freed via a call to
1752 * \c clang_disposeOverriddenCursors().
1753 *
1754 * \param num_overridden A pointer to the number of overridden
1755 * functions, will be set to the number of overridden functions in the
1756 * array pointed to by \p overridden.
1757 */
1758CINDEX_LINKAGE void clang_getOverriddenCursors(CXCursor cursor,
1759                                               CXCursor **overridden,
1760                                               unsigned *num_overridden);
1761
1762/**
1763 * \brief Free the set of overridden cursors returned by \c
1764 * clang_getOverriddenCursors().
1765 */
1766CINDEX_LINKAGE void clang_disposeOverriddenCursors(CXCursor *overridden);
1767
1768/**
1769 * \brief Retrieve the file that is included by the given inclusion directive
1770 * cursor.
1771 */
1772CINDEX_LINKAGE CXFile clang_getIncludedFile(CXCursor cursor);
1773
1774/**
1775 * @}
1776 */
1777
1778/**
1779 * \defgroup CINDEX_CURSOR_SOURCE Mapping between cursors and source code
1780 *
1781 * Cursors represent a location within the Abstract Syntax Tree (AST). These
1782 * routines help map between cursors and the physical locations where the
1783 * described entities occur in the source code. The mapping is provided in
1784 * both directions, so one can map from source code to the AST and back.
1785 *
1786 * @{
1787 */
1788
1789/**
1790 * \brief Map a source location to the cursor that describes the entity at that
1791 * location in the source code.
1792 *
1793 * clang_getCursor() maps an arbitrary source location within a translation
1794 * unit down to the most specific cursor that describes the entity at that
1795 * location. For example, given an expression \c x + y, invoking
1796 * clang_getCursor() with a source location pointing to "x" will return the
1797 * cursor for "x"; similarly for "y". If the cursor points anywhere between
1798 * "x" or "y" (e.g., on the + or the whitespace around it), clang_getCursor()
1799 * will return a cursor referring to the "+" expression.
1800 *
1801 * \returns a cursor representing the entity at the given source location, or
1802 * a NULL cursor if no such entity can be found.
1803 */
1804CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, CXSourceLocation);
1805
1806/**
1807 * \brief Retrieve the physical location of the source constructor referenced
1808 * by the given cursor.
1809 *
1810 * The location of a declaration is typically the location of the name of that
1811 * declaration, where the name of that declaration would occur if it is
1812 * unnamed, or some keyword that introduces that particular declaration.
1813 * The location of a reference is where that reference occurs within the
1814 * source code.
1815 */
1816CINDEX_LINKAGE CXSourceLocation clang_getCursorLocation(CXCursor);
1817
1818/**
1819 * \brief Retrieve the physical extent of the source construct referenced by
1820 * the given cursor.
1821 *
1822 * The extent of a cursor starts with the file/line/column pointing at the
1823 * first character within the source construct that the cursor refers to and
1824 * ends with the last character withinin that source construct. For a
1825 * declaration, the extent covers the declaration itself. For a reference,
1826 * the extent covers the location of the reference (e.g., where the referenced
1827 * entity was actually used).
1828 */
1829CINDEX_LINKAGE CXSourceRange clang_getCursorExtent(CXCursor);
1830
1831/**
1832 * @}
1833 */
1834
1835/**
1836 * \defgroup CINDEX_TYPES Type information for CXCursors
1837 *
1838 * @{
1839 */
1840
1841/**
1842 * \brief Describes the kind of type
1843 */
1844enum CXTypeKind {
1845  /**
1846   * \brief Reprents an invalid type (e.g., where no type is available).
1847   */
1848  CXType_Invalid = 0,
1849
1850  /**
1851   * \brief A type whose specific kind is not exposed via this
1852   * interface.
1853   */
1854  CXType_Unexposed = 1,
1855
1856  /* Builtin types */
1857  CXType_Void = 2,
1858  CXType_Bool = 3,
1859  CXType_Char_U = 4,
1860  CXType_UChar = 5,
1861  CXType_Char16 = 6,
1862  CXType_Char32 = 7,
1863  CXType_UShort = 8,
1864  CXType_UInt = 9,
1865  CXType_ULong = 10,
1866  CXType_ULongLong = 11,
1867  CXType_UInt128 = 12,
1868  CXType_Char_S = 13,
1869  CXType_SChar = 14,
1870  CXType_WChar = 15,
1871  CXType_Short = 16,
1872  CXType_Int = 17,
1873  CXType_Long = 18,
1874  CXType_LongLong = 19,
1875  CXType_Int128 = 20,
1876  CXType_Float = 21,
1877  CXType_Double = 22,
1878  CXType_LongDouble = 23,
1879  CXType_NullPtr = 24,
1880  CXType_Overload = 25,
1881  CXType_Dependent = 26,
1882  CXType_ObjCId = 27,
1883  CXType_ObjCClass = 28,
1884  CXType_ObjCSel = 29,
1885  CXType_FirstBuiltin = CXType_Void,
1886  CXType_LastBuiltin  = CXType_ObjCSel,
1887
1888  CXType_Complex = 100,
1889  CXType_Pointer = 101,
1890  CXType_BlockPointer = 102,
1891  CXType_LValueReference = 103,
1892  CXType_RValueReference = 104,
1893  CXType_Record = 105,
1894  CXType_Enum = 106,
1895  CXType_Typedef = 107,
1896  CXType_ObjCInterface = 108,
1897  CXType_ObjCObjectPointer = 109,
1898  CXType_FunctionNoProto = 110,
1899  CXType_FunctionProto = 111
1900};
1901
1902/**
1903 * \brief The type of an element in the abstract syntax tree.
1904 *
1905 */
1906typedef struct {
1907  enum CXTypeKind kind;
1908  void *data[2];
1909} CXType;
1910
1911/**
1912 * \brief Retrieve the type of a CXCursor (if any).
1913 */
1914CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
1915
1916/**
1917 * \determine Determine whether two CXTypes represent the same type.
1918 *
1919 * \returns non-zero if the CXTypes represent the same type and
1920            zero otherwise.
1921 */
1922CINDEX_LINKAGE unsigned clang_equalTypes(CXType A, CXType B);
1923
1924/**
1925 * \brief Return the canonical type for a CXType.
1926 *
1927 * Clang's type system explicitly models typedefs and all the ways
1928 * a specific type can be represented.  The canonical type is the underlying
1929 * type with all the "sugar" removed.  For example, if 'T' is a typedef
1930 * for 'int', the canonical type for 'T' would be 'int'.
1931 */
1932CINDEX_LINKAGE CXType clang_getCanonicalType(CXType T);
1933
1934/**
1935 *  \determine Determine whether a CXType has the "const" qualifier set,
1936 *  without looking through typedefs that may have added "const" at a different level.
1937 */
1938CINDEX_LINKAGE unsigned clang_isConstQualifiedType(CXType T);
1939
1940/**
1941 *  \determine Determine whether a CXType has the "volatile" qualifier set,
1942 *  without looking through typedefs that may have added "volatile" at a different level.
1943 */
1944CINDEX_LINKAGE unsigned clang_isVolatileQualifiedType(CXType T);
1945
1946/**
1947 *  \determine Determine whether a CXType has the "restrict" qualifier set,
1948 *  without looking through typedefs that may have added "restrict" at a different level.
1949 */
1950CINDEX_LINKAGE unsigned clang_isRestrictQualifiedType(CXType T);
1951
1952/**
1953 * \brief For pointer types, returns the type of the pointee.
1954 *
1955 */
1956CINDEX_LINKAGE CXType clang_getPointeeType(CXType T);
1957
1958/**
1959 * \brief Return the cursor for the declaration of the given type.
1960 */
1961CINDEX_LINKAGE CXCursor clang_getTypeDeclaration(CXType T);
1962
1963/**
1964 * Returns the Objective-C type encoding for the specified declaration.
1965 */
1966CINDEX_LINKAGE CXString clang_getDeclObjCTypeEncoding(CXCursor C);
1967
1968/**
1969 * \brief Retrieve the spelling of a given CXTypeKind.
1970 */
1971CINDEX_LINKAGE CXString clang_getTypeKindSpelling(enum CXTypeKind K);
1972
1973/**
1974 * \brief Retrieve the result type associated with a function type.
1975 */
1976CINDEX_LINKAGE CXType clang_getResultType(CXType T);
1977
1978/**
1979 * \brief Retrieve the result type associated with a given cursor.  This only
1980 *  returns a valid type of the cursor refers to a function or method.
1981 */
1982CINDEX_LINKAGE CXType clang_getCursorResultType(CXCursor C);
1983
1984/**
1985 * \brief Return 1 if the CXType is a POD (plain old data) type, and 0
1986 *  otherwise.
1987 */
1988CINDEX_LINKAGE unsigned clang_isPODType(CXType T);
1989
1990/**
1991 * \brief Returns 1 if the base class specified by the cursor with kind
1992 *   CX_CXXBaseSpecifier is virtual.
1993 */
1994CINDEX_LINKAGE unsigned clang_isVirtualBase(CXCursor);
1995
1996/**
1997 * \brief Represents the C++ access control level to a base class for a
1998 * cursor with kind CX_CXXBaseSpecifier.
1999 */
2000enum CX_CXXAccessSpecifier {
2001  CX_CXXInvalidAccessSpecifier,
2002  CX_CXXPublic,
2003  CX_CXXProtected,
2004  CX_CXXPrivate
2005};
2006
2007/**
2008 * \brief Returns the access control level for the C++ base specifier
2009 *  represented by a cursor with kind CX_CXXBaseSpecifier.
2010 */
2011CINDEX_LINKAGE enum CX_CXXAccessSpecifier clang_getCXXAccessSpecifier(CXCursor);
2012
2013/**
2014 * \brief Determine the number of overloaded declarations referenced by a
2015 * \c CXCursor_OverloadedDeclRef cursor.
2016 *
2017 * \param cursor The cursor whose overloaded declarations are being queried.
2018 *
2019 * \returns The number of overloaded declarations referenced by \c cursor. If it
2020 * is not a \c CXCursor_OverloadedDeclRef cursor, returns 0.
2021 */
2022CINDEX_LINKAGE unsigned clang_getNumOverloadedDecls(CXCursor cursor);
2023
2024/**
2025 * \brief Retrieve a cursor for one of the overloaded declarations referenced
2026 * by a \c CXCursor_OverloadedDeclRef cursor.
2027 *
2028 * \param cursor The cursor whose overloaded declarations are being queried.
2029 *
2030 * \param index The zero-based index into the set of overloaded declarations in
2031 * the cursor.
2032 *
2033 * \returns A cursor representing the declaration referenced by the given
2034 * \c cursor at the specified \c index. If the cursor does not have an
2035 * associated set of overloaded declarations, or if the index is out of bounds,
2036 * returns \c clang_getNullCursor();
2037 */
2038CINDEX_LINKAGE CXCursor clang_getOverloadedDecl(CXCursor cursor,
2039                                                unsigned index);
2040
2041/**
2042 * @}
2043 */
2044
2045/**
2046 * \defgroup CINDEX_ATTRIBUTES Information for attributes
2047 *
2048 * @{
2049 */
2050
2051
2052/**
2053 * \brief For cursors representing an iboutletcollection attribute,
2054 *  this function returns the collection element type.
2055 *
2056 */
2057CINDEX_LINKAGE CXType clang_getIBOutletCollectionType(CXCursor);
2058
2059/**
2060 * @}
2061 */
2062
2063/**
2064 * \defgroup CINDEX_CURSOR_TRAVERSAL Traversing the AST with cursors
2065 *
2066 * These routines provide the ability to traverse the abstract syntax tree
2067 * using cursors.
2068 *
2069 * @{
2070 */
2071
2072/**
2073 * \brief Describes how the traversal of the children of a particular
2074 * cursor should proceed after visiting a particular child cursor.
2075 *
2076 * A value of this enumeration type should be returned by each
2077 * \c CXCursorVisitor to indicate how clang_visitChildren() proceed.
2078 */
2079enum CXChildVisitResult {
2080  /**
2081   * \brief Terminates the cursor traversal.
2082   */
2083  CXChildVisit_Break,
2084  /**
2085   * \brief Continues the cursor traversal with the next sibling of
2086   * the cursor just visited, without visiting its children.
2087   */
2088  CXChildVisit_Continue,
2089  /**
2090   * \brief Recursively traverse the children of this cursor, using
2091   * the same visitor and client data.
2092   */
2093  CXChildVisit_Recurse
2094};
2095
2096/**
2097 * \brief Visitor invoked for each cursor found by a traversal.
2098 *
2099 * This visitor function will be invoked for each cursor found by
2100 * clang_visitCursorChildren(). Its first argument is the cursor being
2101 * visited, its second argument is the parent visitor for that cursor,
2102 * and its third argument is the client data provided to
2103 * clang_visitCursorChildren().
2104 *
2105 * The visitor should return one of the \c CXChildVisitResult values
2106 * to direct clang_visitCursorChildren().
2107 */
2108typedef enum CXChildVisitResult (*CXCursorVisitor)(CXCursor cursor,
2109                                                   CXCursor parent,
2110                                                   CXClientData client_data);
2111
2112/**
2113 * \brief Visit the children of a particular cursor.
2114 *
2115 * This function visits all the direct children of the given cursor,
2116 * invoking the given \p visitor function with the cursors of each
2117 * visited child. The traversal may be recursive, if the visitor returns
2118 * \c CXChildVisit_Recurse. The traversal may also be ended prematurely, if
2119 * the visitor returns \c CXChildVisit_Break.
2120 *
2121 * \param parent the cursor whose child may be visited. All kinds of
2122 * cursors can be visited, including invalid cursors (which, by
2123 * definition, have no children).
2124 *
2125 * \param visitor the visitor function that will be invoked for each
2126 * child of \p parent.
2127 *
2128 * \param client_data pointer data supplied by the client, which will
2129 * be passed to the visitor each time it is invoked.
2130 *
2131 * \returns a non-zero value if the traversal was terminated
2132 * prematurely by the visitor returning \c CXChildVisit_Break.
2133 */
2134CINDEX_LINKAGE unsigned clang_visitChildren(CXCursor parent,
2135                                            CXCursorVisitor visitor,
2136                                            CXClientData client_data);
2137#ifdef __has_feature
2138#  if __has_feature(blocks)
2139/**
2140 * \brief Visitor invoked for each cursor found by a traversal.
2141 *
2142 * This visitor block will be invoked for each cursor found by
2143 * clang_visitChildrenWithBlock(). Its first argument is the cursor being
2144 * visited, its second argument is the parent visitor for that cursor.
2145 *
2146 * The visitor should return one of the \c CXChildVisitResult values
2147 * to direct clang_visitChildrenWithBlock().
2148 */
2149typedef enum CXChildVisitResult
2150     (^CXCursorVisitorBlock)(CXCursor cursor, CXCursor parent);
2151
2152/**
2153 * Visits the children of a cursor using the specified block.  Behaves
2154 * identically to clang_visitChildren() in all other respects.
2155 */
2156unsigned clang_visitChildrenWithBlock(CXCursor parent,
2157                                      CXCursorVisitorBlock block);
2158#  endif
2159#endif
2160
2161/**
2162 * @}
2163 */
2164
2165/**
2166 * \defgroup CINDEX_CURSOR_XREF Cross-referencing in the AST
2167 *
2168 * These routines provide the ability to determine references within and
2169 * across translation units, by providing the names of the entities referenced
2170 * by cursors, follow reference cursors to the declarations they reference,
2171 * and associate declarations with their definitions.
2172 *
2173 * @{
2174 */
2175
2176/**
2177 * \brief Retrieve a Unified Symbol Resolution (USR) for the entity referenced
2178 * by the given cursor.
2179 *
2180 * A Unified Symbol Resolution (USR) is a string that identifies a particular
2181 * entity (function, class, variable, etc.) within a program. USRs can be
2182 * compared across translation units to determine, e.g., when references in
2183 * one translation refer to an entity defined in another translation unit.
2184 */
2185CINDEX_LINKAGE CXString clang_getCursorUSR(CXCursor);
2186
2187/**
2188 * \brief Construct a USR for a specified Objective-C class.
2189 */
2190CINDEX_LINKAGE CXString clang_constructUSR_ObjCClass(const char *class_name);
2191
2192/**
2193 * \brief Construct a USR for a specified Objective-C category.
2194 */
2195CINDEX_LINKAGE CXString
2196  clang_constructUSR_ObjCCategory(const char *class_name,
2197                                 const char *category_name);
2198
2199/**
2200 * \brief Construct a USR for a specified Objective-C protocol.
2201 */
2202CINDEX_LINKAGE CXString
2203  clang_constructUSR_ObjCProtocol(const char *protocol_name);
2204
2205
2206/**
2207 * \brief Construct a USR for a specified Objective-C instance variable and
2208 *   the USR for its containing class.
2209 */
2210CINDEX_LINKAGE CXString clang_constructUSR_ObjCIvar(const char *name,
2211                                                    CXString classUSR);
2212
2213/**
2214 * \brief Construct a USR for a specified Objective-C method and
2215 *   the USR for its containing class.
2216 */
2217CINDEX_LINKAGE CXString clang_constructUSR_ObjCMethod(const char *name,
2218                                                      unsigned isInstanceMethod,
2219                                                      CXString classUSR);
2220
2221/**
2222 * \brief Construct a USR for a specified Objective-C property and the USR
2223 *  for its containing class.
2224 */
2225CINDEX_LINKAGE CXString clang_constructUSR_ObjCProperty(const char *property,
2226                                                        CXString classUSR);
2227
2228/**
2229 * \brief Retrieve a name for the entity referenced by this cursor.
2230 */
2231CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);
2232
2233/**
2234 * \brief Retrieve the display name for the entity referenced by this cursor.
2235 *
2236 * The display name contains extra information that helps identify the cursor,
2237 * such as the parameters of a function or template or the arguments of a
2238 * class template specialization.
2239 */
2240CINDEX_LINKAGE CXString clang_getCursorDisplayName(CXCursor);
2241
2242/** \brief For a cursor that is a reference, retrieve a cursor representing the
2243 * entity that it references.
2244 *
2245 * Reference cursors refer to other entities in the AST. For example, an
2246 * Objective-C superclass reference cursor refers to an Objective-C class.
2247 * This function produces the cursor for the Objective-C class from the
2248 * cursor for the superclass reference. If the input cursor is a declaration or
2249 * definition, it returns that declaration or definition unchanged.
2250 * Otherwise, returns the NULL cursor.
2251 */
2252CINDEX_LINKAGE CXCursor clang_getCursorReferenced(CXCursor);
2253
2254/**
2255 *  \brief For a cursor that is either a reference to or a declaration
2256 *  of some entity, retrieve a cursor that describes the definition of
2257 *  that entity.
2258 *
2259 *  Some entities can be declared multiple times within a translation
2260 *  unit, but only one of those declarations can also be a
2261 *  definition. For example, given:
2262 *
2263 *  \code
2264 *  int f(int, int);
2265 *  int g(int x, int y) { return f(x, y); }
2266 *  int f(int a, int b) { return a + b; }
2267 *  int f(int, int);
2268 *  \endcode
2269 *
2270 *  there are three declarations of the function "f", but only the
2271 *  second one is a definition. The clang_getCursorDefinition()
2272 *  function will take any cursor pointing to a declaration of "f"
2273 *  (the first or fourth lines of the example) or a cursor referenced
2274 *  that uses "f" (the call to "f' inside "g") and will return a
2275 *  declaration cursor pointing to the definition (the second "f"
2276 *  declaration).
2277 *
2278 *  If given a cursor for which there is no corresponding definition,
2279 *  e.g., because there is no definition of that entity within this
2280 *  translation unit, returns a NULL cursor.
2281 */
2282CINDEX_LINKAGE CXCursor clang_getCursorDefinition(CXCursor);
2283
2284/**
2285 * \brief Determine whether the declaration pointed to by this cursor
2286 * is also a definition of that entity.
2287 */
2288CINDEX_LINKAGE unsigned clang_isCursorDefinition(CXCursor);
2289
2290/**
2291 * \brief Retrieve the canonical cursor corresponding to the given cursor.
2292 *
2293 * In the C family of languages, many kinds of entities can be declared several
2294 * times within a single translation unit. For example, a structure type can
2295 * be forward-declared (possibly multiple times) and later defined:
2296 *
2297 * \code
2298 * struct X;
2299 * struct X;
2300 * struct X {
2301 *   int member;
2302 * };
2303 * \endcode
2304 *
2305 * The declarations and the definition of \c X are represented by three
2306 * different cursors, all of which are declarations of the same underlying
2307 * entity. One of these cursor is considered the "canonical" cursor, which
2308 * is effectively the representative for the underlying entity. One can
2309 * determine if two cursors are declarations of the same underlying entity by
2310 * comparing their canonical cursors.
2311 *
2312 * \returns The canonical cursor for the entity referred to by the given cursor.
2313 */
2314CINDEX_LINKAGE CXCursor clang_getCanonicalCursor(CXCursor);
2315
2316/**
2317 * @}
2318 */
2319
2320/**
2321 * \defgroup CINDEX_CPP C++ AST introspection
2322 *
2323 * The routines in this group provide access information in the ASTs specific
2324 * to C++ language features.
2325 *
2326 * @{
2327 */
2328
2329/**
2330 * \brief Determine if a C++ member function or member function template is
2331 * declared 'static'.
2332 */
2333CINDEX_LINKAGE unsigned clang_CXXMethod_isStatic(CXCursor C);
2334
2335/**
2336 * \brief Determine if a C++ member function or member function template is
2337 * explicitly declared 'virtual' or if it overrides a virtual method from
2338 * one of the base classes.
2339 */
2340CINDEX_LINKAGE unsigned clang_CXXMethod_isVirtual(CXCursor C);
2341
2342/**
2343 * \brief Given a cursor that represents a template, determine
2344 * the cursor kind of the specializations would be generated by instantiating
2345 * the template.
2346 *
2347 * This routine can be used to determine what flavor of function template,
2348 * class template, or class template partial specialization is stored in the
2349 * cursor. For example, it can describe whether a class template cursor is
2350 * declared with "struct", "class" or "union".
2351 *
2352 * \param C The cursor to query. This cursor should represent a template
2353 * declaration.
2354 *
2355 * \returns The cursor kind of the specializations that would be generated
2356 * by instantiating the template \p C. If \p C is not a template, returns
2357 * \c CXCursor_NoDeclFound.
2358 */
2359CINDEX_LINKAGE enum CXCursorKind clang_getTemplateCursorKind(CXCursor C);
2360
2361/**
2362 * \brief Given a cursor that may represent a specialization or instantiation
2363 * of a template, retrieve the cursor that represents the template that it
2364 * specializes or from which it was instantiated.
2365 *
2366 * This routine determines the template involved both for explicit
2367 * specializations of templates and for implicit instantiations of the template,
2368 * both of which are referred to as "specializations". For a class template
2369 * specialization (e.g., \c std::vector<bool>), this routine will return
2370 * either the primary template (\c std::vector) or, if the specialization was
2371 * instantiated from a class template partial specialization, the class template
2372 * partial specialization. For a class template partial specialization and a
2373 * function template specialization (including instantiations), this
2374 * this routine will return the specialized template.
2375 *
2376 * For members of a class template (e.g., member functions, member classes, or
2377 * static data members), returns the specialized or instantiated member.
2378 * Although not strictly "templates" in the C++ language, members of class
2379 * templates have the same notions of specializations and instantiations that
2380 * templates do, so this routine treats them similarly.
2381 *
2382 * \param C A cursor that may be a specialization of a template or a member
2383 * of a template.
2384 *
2385 * \returns If the given cursor is a specialization or instantiation of a
2386 * template or a member thereof, the template or member that it specializes or
2387 * from which it was instantiated. Otherwise, returns a NULL cursor.
2388 */
2389CINDEX_LINKAGE CXCursor clang_getSpecializedCursorTemplate(CXCursor C);
2390
2391/**
2392 * \brief Given a cursor that references something else, return the source range
2393 * covering that reference.
2394 *
2395 * \param C A cursor pointing to a member reference, a declaration reference, or
2396 * an operator call.
2397 * \param NameFlags A bitset with three independent flags:
2398 * CXNameRange_WantQualifier, CXNameRange_WantTemplateArgs, and
2399 * CXNameRange_WantSinglePiece.
2400 * \param PieceIndex For contiguous names or when passing the flag
2401 * CXNameRange_WantSinglePiece, only one piece with index 0 is
2402 * available. When the CXNameRange_WantSinglePiece flag is not passed for a
2403 * non-contiguous names, this index can be used to retreive the individual
2404 * pieces of the name. See also CXNameRange_WantSinglePiece.
2405 *
2406 * \returns The piece of the name pointed to by the given cursor. If there is no
2407 * name, or if the PieceIndex is out-of-range, a null-cursor will be returned.
2408 */
2409CINDEX_LINKAGE CXSourceRange clang_getCursorReferenceNameRange(CXCursor C,
2410                                                unsigned NameFlags,
2411                                                unsigned PieceIndex);
2412
2413enum CXNameRefFlags {
2414  /**
2415   * \brief Include the nested-name-specifier, e.g. Foo:: in x.Foo::y, in the
2416   * range.
2417   */
2418  CXNameRange_WantQualifier = 0x1,
2419
2420  /**
2421   * \brief Include the explicit template arguments, e.g. <int> in x.f<int>, in
2422   * the range.
2423   */
2424  CXNameRange_WantTemplateArgs = 0x2,
2425
2426  /**
2427   * \brief If the name is non-contiguous, return the full spanning range.
2428   *
2429   * Non-contiguous names occur in Objective-C when a selector with two or more
2430   * parameters is used, or in C++ when using an operator:
2431   * \code
2432   * [object doSomething:here withValue:there]; // ObjC
2433   * return some_vector[1]; // C++
2434   * \endcode
2435   */
2436  CXNameRange_WantSinglePiece = 0x4
2437};
2438
2439/**
2440 * @}
2441 */
2442
2443/**
2444 * \defgroup CINDEX_LEX Token extraction and manipulation
2445 *
2446 * The routines in this group provide access to the tokens within a
2447 * translation unit, along with a semantic mapping of those tokens to
2448 * their corresponding cursors.
2449 *
2450 * @{
2451 */
2452
2453/**
2454 * \brief Describes a kind of token.
2455 */
2456typedef enum CXTokenKind {
2457  /**
2458   * \brief A token that contains some kind of punctuation.
2459   */
2460  CXToken_Punctuation,
2461
2462  /**
2463   * \brief A language keyword.
2464   */
2465  CXToken_Keyword,
2466
2467  /**
2468   * \brief An identifier (that is not a keyword).
2469   */
2470  CXToken_Identifier,
2471
2472  /**
2473   * \brief A numeric, string, or character literal.
2474   */
2475  CXToken_Literal,
2476
2477  /**
2478   * \brief A comment.
2479   */
2480  CXToken_Comment
2481} CXTokenKind;
2482
2483/**
2484 * \brief Describes a single preprocessing token.
2485 */
2486typedef struct {
2487  unsigned int_data[4];
2488  void *ptr_data;
2489} CXToken;
2490
2491/**
2492 * \brief Determine the kind of the given token.
2493 */
2494CINDEX_LINKAGE CXTokenKind clang_getTokenKind(CXToken);
2495
2496/**
2497 * \brief Determine the spelling of the given token.
2498 *
2499 * The spelling of a token is the textual representation of that token, e.g.,
2500 * the text of an identifier or keyword.
2501 */
2502CINDEX_LINKAGE CXString clang_getTokenSpelling(CXTranslationUnit, CXToken);
2503
2504/**
2505 * \brief Retrieve the source location of the given token.
2506 */
2507CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
2508                                                       CXToken);
2509
2510/**
2511 * \brief Retrieve a source range that covers the given token.
2512 */
2513CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
2514
2515/**
2516 * \brief Tokenize the source code described by the given range into raw
2517 * lexical tokens.
2518 *
2519 * \param TU the translation unit whose text is being tokenized.
2520 *
2521 * \param Range the source range in which text should be tokenized. All of the
2522 * tokens produced by tokenization will fall within this source range,
2523 *
2524 * \param Tokens this pointer will be set to point to the array of tokens
2525 * that occur within the given source range. The returned pointer must be
2526 * freed with clang_disposeTokens() before the translation unit is destroyed.
2527 *
2528 * \param NumTokens will be set to the number of tokens in the \c *Tokens
2529 * array.
2530 *
2531 */
2532CINDEX_LINKAGE void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
2533                                   CXToken **Tokens, unsigned *NumTokens);
2534
2535/**
2536 * \brief Annotate the given set of tokens by providing cursors for each token
2537 * that can be mapped to a specific entity within the abstract syntax tree.
2538 *
2539 * This token-annotation routine is equivalent to invoking
2540 * clang_getCursor() for the source locations of each of the
2541 * tokens. The cursors provided are filtered, so that only those
2542 * cursors that have a direct correspondence to the token are
2543 * accepted. For example, given a function call \c f(x),
2544 * clang_getCursor() would provide the following cursors:
2545 *
2546 *   * when the cursor is over the 'f', a DeclRefExpr cursor referring to 'f'.
2547 *   * when the cursor is over the '(' or the ')', a CallExpr referring to 'f'.
2548 *   * when the cursor is over the 'x', a DeclRefExpr cursor referring to 'x'.
2549 *
2550 * Only the first and last of these cursors will occur within the
2551 * annotate, since the tokens "f" and "x' directly refer to a function
2552 * and a variable, respectively, but the parentheses are just a small
2553 * part of the full syntax of the function call expression, which is
2554 * not provided as an annotation.
2555 *
2556 * \param TU the translation unit that owns the given tokens.
2557 *
2558 * \param Tokens the set of tokens to annotate.
2559 *
2560 * \param NumTokens the number of tokens in \p Tokens.
2561 *
2562 * \param Cursors an array of \p NumTokens cursors, whose contents will be
2563 * replaced with the cursors corresponding to each token.
2564 */
2565CINDEX_LINKAGE void clang_annotateTokens(CXTranslationUnit TU,
2566                                         CXToken *Tokens, unsigned NumTokens,
2567                                         CXCursor *Cursors);
2568
2569/**
2570 * \brief Free the given set of tokens.
2571 */
2572CINDEX_LINKAGE void clang_disposeTokens(CXTranslationUnit TU,
2573                                        CXToken *Tokens, unsigned NumTokens);
2574
2575/**
2576 * @}
2577 */
2578
2579/**
2580 * \defgroup CINDEX_DEBUG Debugging facilities
2581 *
2582 * These routines are used for testing and debugging, only, and should not
2583 * be relied upon.
2584 *
2585 * @{
2586 */
2587
2588/* for debug/testing */
2589CINDEX_LINKAGE CXString clang_getCursorKindSpelling(enum CXCursorKind Kind);
2590CINDEX_LINKAGE void clang_getDefinitionSpellingAndExtent(CXCursor,
2591                                          const char **startBuf,
2592                                          const char **endBuf,
2593                                          unsigned *startLine,
2594                                          unsigned *startColumn,
2595                                          unsigned *endLine,
2596                                          unsigned *endColumn);
2597CINDEX_LINKAGE void clang_enableStackTraces(void);
2598CINDEX_LINKAGE void clang_executeOnThread(void (*fn)(void*), void *user_data,
2599                                          unsigned stack_size);
2600
2601/**
2602 * @}
2603 */
2604
2605/**
2606 * \defgroup CINDEX_CODE_COMPLET Code completion
2607 *
2608 * Code completion involves taking an (incomplete) source file, along with
2609 * knowledge of where the user is actively editing that file, and suggesting
2610 * syntactically- and semantically-valid constructs that the user might want to
2611 * use at that particular point in the source code. These data structures and
2612 * routines provide support for code completion.
2613 *
2614 * @{
2615 */
2616
2617/**
2618 * \brief A semantic string that describes a code-completion result.
2619 *
2620 * A semantic string that describes the formatting of a code-completion
2621 * result as a single "template" of text that should be inserted into the
2622 * source buffer when a particular code-completion result is selected.
2623 * Each semantic string is made up of some number of "chunks", each of which
2624 * contains some text along with a description of what that text means, e.g.,
2625 * the name of the entity being referenced, whether the text chunk is part of
2626 * the template, or whether it is a "placeholder" that the user should replace
2627 * with actual code,of a specific kind. See \c CXCompletionChunkKind for a
2628 * description of the different kinds of chunks.
2629 */
2630typedef void *CXCompletionString;
2631
2632/**
2633 * \brief A single result of code completion.
2634 */
2635typedef struct {
2636  /**
2637   * \brief The kind of entity that this completion refers to.
2638   *
2639   * The cursor kind will be a macro, keyword, or a declaration (one of the
2640   * *Decl cursor kinds), describing the entity that the completion is
2641   * referring to.
2642   *
2643   * \todo In the future, we would like to provide a full cursor, to allow
2644   * the client to extract additional information from declaration.
2645   */
2646  enum CXCursorKind CursorKind;
2647
2648  /**
2649   * \brief The code-completion string that describes how to insert this
2650   * code-completion result into the editing buffer.
2651   */
2652  CXCompletionString CompletionString;
2653} CXCompletionResult;
2654
2655/**
2656 * \brief Describes a single piece of text within a code-completion string.
2657 *
2658 * Each "chunk" within a code-completion string (\c CXCompletionString) is
2659 * either a piece of text with a specific "kind" that describes how that text
2660 * should be interpreted by the client or is another completion string.
2661 */
2662enum CXCompletionChunkKind {
2663  /**
2664   * \brief A code-completion string that describes "optional" text that
2665   * could be a part of the template (but is not required).
2666   *
2667   * The Optional chunk is the only kind of chunk that has a code-completion
2668   * string for its representation, which is accessible via
2669   * \c clang_getCompletionChunkCompletionString(). The code-completion string
2670   * describes an additional part of the template that is completely optional.
2671   * For example, optional chunks can be used to describe the placeholders for
2672   * arguments that match up with defaulted function parameters, e.g. given:
2673   *
2674   * \code
2675   * void f(int x, float y = 3.14, double z = 2.71828);
2676   * \endcode
2677   *
2678   * The code-completion string for this function would contain:
2679   *   - a TypedText chunk for "f".
2680   *   - a LeftParen chunk for "(".
2681   *   - a Placeholder chunk for "int x"
2682   *   - an Optional chunk containing the remaining defaulted arguments, e.g.,
2683   *       - a Comma chunk for ","
2684   *       - a Placeholder chunk for "float y"
2685   *       - an Optional chunk containing the last defaulted argument:
2686   *           - a Comma chunk for ","
2687   *           - a Placeholder chunk for "double z"
2688   *   - a RightParen chunk for ")"
2689   *
2690   * There are many ways to handle Optional chunks. Two simple approaches are:
2691   *   - Completely ignore optional chunks, in which case the template for the
2692   *     function "f" would only include the first parameter ("int x").
2693   *   - Fully expand all optional chunks, in which case the template for the
2694   *     function "f" would have all of the parameters.
2695   */
2696  CXCompletionChunk_Optional,
2697  /**
2698   * \brief Text that a user would be expected to type to get this
2699   * code-completion result.
2700   *
2701   * There will be exactly one "typed text" chunk in a semantic string, which
2702   * will typically provide the spelling of a keyword or the name of a
2703   * declaration that could be used at the current code point. Clients are
2704   * expected to filter the code-completion results based on the text in this
2705   * chunk.
2706   */
2707  CXCompletionChunk_TypedText,
2708  /**
2709   * \brief Text that should be inserted as part of a code-completion result.
2710   *
2711   * A "text" chunk represents text that is part of the template to be
2712   * inserted into user code should this particular code-completion result
2713   * be selected.
2714   */
2715  CXCompletionChunk_Text,
2716  /**
2717   * \brief Placeholder text that should be replaced by the user.
2718   *
2719   * A "placeholder" chunk marks a place where the user should insert text
2720   * into the code-completion template. For example, placeholders might mark
2721   * the function parameters for a function declaration, to indicate that the
2722   * user should provide arguments for each of those parameters. The actual
2723   * text in a placeholder is a suggestion for the text to display before
2724   * the user replaces the placeholder with real code.
2725   */
2726  CXCompletionChunk_Placeholder,
2727  /**
2728   * \brief Informative text that should be displayed but never inserted as
2729   * part of the template.
2730   *
2731   * An "informative" chunk contains annotations that can be displayed to
2732   * help the user decide whether a particular code-completion result is the
2733   * right option, but which is not part of the actual template to be inserted
2734   * by code completion.
2735   */
2736  CXCompletionChunk_Informative,
2737  /**
2738   * \brief Text that describes the current parameter when code-completion is
2739   * referring to function call, message send, or template specialization.
2740   *
2741   * A "current parameter" chunk occurs when code-completion is providing
2742   * information about a parameter corresponding to the argument at the
2743   * code-completion point. For example, given a function
2744   *
2745   * \code
2746   * int add(int x, int y);
2747   * \endcode
2748   *
2749   * and the source code \c add(, where the code-completion point is after the
2750   * "(", the code-completion string will contain a "current parameter" chunk
2751   * for "int x", indicating that the current argument will initialize that
2752   * parameter. After typing further, to \c add(17, (where the code-completion
2753   * point is after the ","), the code-completion string will contain a
2754   * "current paremeter" chunk to "int y".
2755   */
2756  CXCompletionChunk_CurrentParameter,
2757  /**
2758   * \brief A left parenthesis ('('), used to initiate a function call or
2759   * signal the beginning of a function parameter list.
2760   */
2761  CXCompletionChunk_LeftParen,
2762  /**
2763   * \brief A right parenthesis (')'), used to finish a function call or
2764   * signal the end of a function parameter list.
2765   */
2766  CXCompletionChunk_RightParen,
2767  /**
2768   * \brief A left bracket ('[').
2769   */
2770  CXCompletionChunk_LeftBracket,
2771  /**
2772   * \brief A right bracket (']').
2773   */
2774  CXCompletionChunk_RightBracket,
2775  /**
2776   * \brief A left brace ('{').
2777   */
2778  CXCompletionChunk_LeftBrace,
2779  /**
2780   * \brief A right brace ('}').
2781   */
2782  CXCompletionChunk_RightBrace,
2783  /**
2784   * \brief A left angle bracket ('<').
2785   */
2786  CXCompletionChunk_LeftAngle,
2787  /**
2788   * \brief A right angle bracket ('>').
2789   */
2790  CXCompletionChunk_RightAngle,
2791  /**
2792   * \brief A comma separator (',').
2793   */
2794  CXCompletionChunk_Comma,
2795  /**
2796   * \brief Text that specifies the result type of a given result.
2797   *
2798   * This special kind of informative chunk is not meant to be inserted into
2799   * the text buffer. Rather, it is meant to illustrate the type that an
2800   * expression using the given completion string would have.
2801   */
2802  CXCompletionChunk_ResultType,
2803  /**
2804   * \brief A colon (':').
2805   */
2806  CXCompletionChunk_Colon,
2807  /**
2808   * \brief A semicolon (';').
2809   */
2810  CXCompletionChunk_SemiColon,
2811  /**
2812   * \brief An '=' sign.
2813   */
2814  CXCompletionChunk_Equal,
2815  /**
2816   * Horizontal space (' ').
2817   */
2818  CXCompletionChunk_HorizontalSpace,
2819  /**
2820   * Vertical space ('\n'), after which it is generally a good idea to
2821   * perform indentation.
2822   */
2823  CXCompletionChunk_VerticalSpace
2824};
2825
2826/**
2827 * \brief Determine the kind of a particular chunk within a completion string.
2828 *
2829 * \param completion_string the completion string to query.
2830 *
2831 * \param chunk_number the 0-based index of the chunk in the completion string.
2832 *
2833 * \returns the kind of the chunk at the index \c chunk_number.
2834 */
2835CINDEX_LINKAGE enum CXCompletionChunkKind
2836clang_getCompletionChunkKind(CXCompletionString completion_string,
2837                             unsigned chunk_number);
2838
2839/**
2840 * \brief Retrieve the text associated with a particular chunk within a
2841 * completion string.
2842 *
2843 * \param completion_string the completion string to query.
2844 *
2845 * \param chunk_number the 0-based index of the chunk in the completion string.
2846 *
2847 * \returns the text associated with the chunk at index \c chunk_number.
2848 */
2849CINDEX_LINKAGE CXString
2850clang_getCompletionChunkText(CXCompletionString completion_string,
2851                             unsigned chunk_number);
2852
2853/**
2854 * \brief Retrieve the completion string associated with a particular chunk
2855 * within a completion string.
2856 *
2857 * \param completion_string the completion string to query.
2858 *
2859 * \param chunk_number the 0-based index of the chunk in the completion string.
2860 *
2861 * \returns the completion string associated with the chunk at index
2862 * \c chunk_number, or NULL if that chunk is not represented by a completion
2863 * string.
2864 */
2865CINDEX_LINKAGE CXCompletionString
2866clang_getCompletionChunkCompletionString(CXCompletionString completion_string,
2867                                         unsigned chunk_number);
2868
2869/**
2870 * \brief Retrieve the number of chunks in the given code-completion string.
2871 */
2872CINDEX_LINKAGE unsigned
2873clang_getNumCompletionChunks(CXCompletionString completion_string);
2874
2875/**
2876 * \brief Determine the priority of this code completion.
2877 *
2878 * The priority of a code completion indicates how likely it is that this
2879 * particular completion is the completion that the user will select. The
2880 * priority is selected by various internal heuristics.
2881 *
2882 * \param completion_string The completion string to query.
2883 *
2884 * \returns The priority of this completion string. Smaller values indicate
2885 * higher-priority (more likely) completions.
2886 */
2887CINDEX_LINKAGE unsigned
2888clang_getCompletionPriority(CXCompletionString completion_string);
2889
2890/**
2891 * \brief Determine the availability of the entity that this code-completion
2892 * string refers to.
2893 *
2894 * \param completion_string The completion string to query.
2895 *
2896 * \returns The availability of the completion string.
2897 */
2898CINDEX_LINKAGE enum CXAvailabilityKind
2899clang_getCompletionAvailability(CXCompletionString completion_string);
2900
2901/**
2902 * \brief Retrieve a completion string for an arbitrary declaration or macro
2903 * definition cursor.
2904 *
2905 * \param cursor The cursor to query.
2906 *
2907 * \returns A non-context-sensitive completion string for declaration and macro
2908 * definition cursors, or NULL for other kinds of cursors.
2909 */
2910CINDEX_LINKAGE CXCompletionString
2911clang_getCursorCompletionString(CXCursor cursor);
2912
2913/**
2914 * \brief Contains the results of code-completion.
2915 *
2916 * This data structure contains the results of code completion, as
2917 * produced by \c clang_codeCompleteAt(). Its contents must be freed by
2918 * \c clang_disposeCodeCompleteResults.
2919 */
2920typedef struct {
2921  /**
2922   * \brief The code-completion results.
2923   */
2924  CXCompletionResult *Results;
2925
2926  /**
2927   * \brief The number of code-completion results stored in the
2928   * \c Results array.
2929   */
2930  unsigned NumResults;
2931} CXCodeCompleteResults;
2932
2933/**
2934 * \brief Flags that can be passed to \c clang_codeCompleteAt() to
2935 * modify its behavior.
2936 *
2937 * The enumerators in this enumeration can be bitwise-OR'd together to
2938 * provide multiple options to \c clang_codeCompleteAt().
2939 */
2940enum CXCodeComplete_Flags {
2941  /**
2942   * \brief Whether to include macros within the set of code
2943   * completions returned.
2944   */
2945  CXCodeComplete_IncludeMacros = 0x01,
2946
2947  /**
2948   * \brief Whether to include code patterns for language constructs
2949   * within the set of code completions, e.g., for loops.
2950   */
2951  CXCodeComplete_IncludeCodePatterns = 0x02
2952};
2953
2954/**
2955 * \brief Bits that represent the context under which completion is occurring.
2956 *
2957 * The enumerators in this enumeration may be bitwise-OR'd together if multiple
2958 * contexts are occurring simultaneously.
2959 */
2960enum CXCompletionContext {
2961  /**
2962   * \brief The context for completions is unexposed, as only Clang results
2963   * should be included. (This is equivalent to having no context bits set.)
2964   */
2965  CXCompletionContext_Unexposed = 0,
2966
2967  /**
2968   * \brief Completions for any possible type should be included in the results.
2969   */
2970  CXCompletionContext_AnyType = 1 << 0,
2971
2972  /**
2973   * \brief Completions for any possible value (variables, function calls, etc.)
2974   * should be included in the results.
2975   */
2976  CXCompletionContext_AnyValue = 1 << 1,
2977  /**
2978   * \brief Completions for values that resolve to an Objective-C object should
2979   * be included in the results.
2980   */
2981  CXCompletionContext_ObjCObjectValue = 1 << 2,
2982  /**
2983   * \brief Completions for values that resolve to an Objective-C selector
2984   * should be included in the results.
2985   */
2986  CXCompletionContext_ObjCSelectorValue = 1 << 3,
2987  /**
2988   * \brief Completions for values that resolve to a C++ class type should be
2989   * included in the results.
2990   */
2991  CXCompletionContext_CXXClassTypeValue = 1 << 4,
2992
2993  /**
2994   * \brief Completions for fields of the member being accessed using the dot
2995   * operator should be included in the results.
2996   */
2997  CXCompletionContext_DotMemberAccess = 1 << 5,
2998  /**
2999   * \brief Completions for fields of the member being accessed using the arrow
3000   * operator should be included in the results.
3001   */
3002  CXCompletionContext_ArrowMemberAccess = 1 << 6,
3003  /**
3004   * \brief Completions for properties of the Objective-C object being accessed
3005   * using the dot operator should be included in the results.
3006   */
3007  CXCompletionContext_ObjCPropertyAccess = 1 << 7,
3008
3009  /**
3010   * \brief Completions for enum tags should be included in the results.
3011   */
3012  CXCompletionContext_EnumTag = 1 << 8,
3013  /**
3014   * \brief Completions for union tags should be included in the results.
3015   */
3016  CXCompletionContext_UnionTag = 1 << 9,
3017  /**
3018   * \brief Completions for struct tags should be included in the results.
3019   */
3020  CXCompletionContext_StructTag = 1 << 10,
3021
3022  /**
3023   * \brief Completions for C++ class names should be included in the results.
3024   */
3025  CXCompletionContext_ClassTag = 1 << 11,
3026  /**
3027   * \brief Completions for C++ namespaces and namespace aliases should be
3028   * included in the results.
3029   */
3030  CXCompletionContext_Namespace = 1 << 12,
3031  /**
3032   * \brief Completions for C++ nested name specifiers should be included in
3033   * the results.
3034   */
3035  CXCompletionContext_NestedNameSpecifier = 1 << 13,
3036
3037  /**
3038   * \brief Completions for Objective-C interfaces (classes) should be included
3039   * in the results.
3040   */
3041  CXCompletionContext_ObjCInterface = 1 << 14,
3042  /**
3043   * \brief Completions for Objective-C protocols should be included in
3044   * the results.
3045   */
3046  CXCompletionContext_ObjCProtocol = 1 << 15,
3047  /**
3048   * \brief Completions for Objective-C categories should be included in
3049   * the results.
3050   */
3051  CXCompletionContext_ObjCCategory = 1 << 16,
3052  /**
3053   * \brief Completions for Objective-C instance messages should be included
3054   * in the results.
3055   */
3056  CXCompletionContext_ObjCInstanceMessage = 1 << 17,
3057  /**
3058   * \brief Completions for Objective-C class messages should be included in
3059   * the results.
3060   */
3061  CXCompletionContext_ObjCClassMessage = 1 << 18,
3062  /**
3063   * \brief Completions for Objective-C selector names should be included in
3064   * the results.
3065   */
3066  CXCompletionContext_ObjCSelectorName = 1 << 19,
3067
3068  /**
3069   * \brief Completions for preprocessor macro names should be included in
3070   * the results.
3071   */
3072  CXCompletionContext_MacroName = 1 << 20,
3073
3074  /**
3075   * \brief Natural language completions should be included in the results.
3076   */
3077  CXCompletionContext_NaturalLanguage = 1 << 21,
3078
3079  /**
3080   * \brief The current context is unknown, so set all contexts.
3081   */
3082  CXCompletionContext_Unknown = ((1 << 22) - 1)
3083};
3084
3085/**
3086 * \brief Returns a default set of code-completion options that can be
3087 * passed to\c clang_codeCompleteAt().
3088 */
3089CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
3090
3091/**
3092 * \brief Perform code completion at a given location in a translation unit.
3093 *
3094 * This function performs code completion at a particular file, line, and
3095 * column within source code, providing results that suggest potential
3096 * code snippets based on the context of the completion. The basic model
3097 * for code completion is that Clang will parse a complete source file,
3098 * performing syntax checking up to the location where code-completion has
3099 * been requested. At that point, a special code-completion token is passed
3100 * to the parser, which recognizes this token and determines, based on the
3101 * current location in the C/Objective-C/C++ grammar and the state of
3102 * semantic analysis, what completions to provide. These completions are
3103 * returned via a new \c CXCodeCompleteResults structure.
3104 *
3105 * Code completion itself is meant to be triggered by the client when the
3106 * user types punctuation characters or whitespace, at which point the
3107 * code-completion location will coincide with the cursor. For example, if \c p
3108 * is a pointer, code-completion might be triggered after the "-" and then
3109 * after the ">" in \c p->. When the code-completion location is afer the ">",
3110 * the completion results will provide, e.g., the members of the struct that
3111 * "p" points to. The client is responsible for placing the cursor at the
3112 * beginning of the token currently being typed, then filtering the results
3113 * based on the contents of the token. For example, when code-completing for
3114 * the expression \c p->get, the client should provide the location just after
3115 * the ">" (e.g., pointing at the "g") to this code-completion hook. Then, the
3116 * client can filter the results based on the current token text ("get"), only
3117 * showing those results that start with "get". The intent of this interface
3118 * is to separate the relatively high-latency acquisition of code-completion
3119 * results from the filtering of results on a per-character basis, which must
3120 * have a lower latency.
3121 *
3122 * \param TU The translation unit in which code-completion should
3123 * occur. The source files for this translation unit need not be
3124 * completely up-to-date (and the contents of those source files may
3125 * be overridden via \p unsaved_files). Cursors referring into the
3126 * translation unit may be invalidated by this invocation.
3127 *
3128 * \param complete_filename The name of the source file where code
3129 * completion should be performed. This filename may be any file
3130 * included in the translation unit.
3131 *
3132 * \param complete_line The line at which code-completion should occur.
3133 *
3134 * \param complete_column The column at which code-completion should occur.
3135 * Note that the column should point just after the syntactic construct that
3136 * initiated code completion, and not in the middle of a lexical token.
3137 *
3138 * \param unsaved_files the Tiles that have not yet been saved to disk
3139 * but may be required for parsing or code completion, including the
3140 * contents of those files.  The contents and name of these files (as
3141 * specified by CXUnsavedFile) are copied when necessary, so the
3142 * client only needs to guarantee their validity until the call to
3143 * this function returns.
3144 *
3145 * \param num_unsaved_files The number of unsaved file entries in \p
3146 * unsaved_files.
3147 *
3148 * \param options Extra options that control the behavior of code
3149 * completion, expressed as a bitwise OR of the enumerators of the
3150 * CXCodeComplete_Flags enumeration. The
3151 * \c clang_defaultCodeCompleteOptions() function returns a default set
3152 * of code-completion options.
3153 *
3154 * \returns If successful, a new \c CXCodeCompleteResults structure
3155 * containing code-completion results, which should eventually be
3156 * freed with \c clang_disposeCodeCompleteResults(). If code
3157 * completion fails, returns NULL.
3158 */
3159CINDEX_LINKAGE
3160CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
3161                                            const char *complete_filename,
3162                                            unsigned complete_line,
3163                                            unsigned complete_column,
3164                                            struct CXUnsavedFile *unsaved_files,
3165                                            unsigned num_unsaved_files,
3166                                            unsigned options);
3167
3168/**
3169 * \brief Sort the code-completion results in case-insensitive alphabetical
3170 * order.
3171 *
3172 * \param Results The set of results to sort.
3173 * \param NumResults The number of results in \p Results.
3174 */
3175CINDEX_LINKAGE
3176void clang_sortCodeCompletionResults(CXCompletionResult *Results,
3177                                     unsigned NumResults);
3178
3179/**
3180 * \brief Free the given set of code-completion results.
3181 */
3182CINDEX_LINKAGE
3183void clang_disposeCodeCompleteResults(CXCodeCompleteResults *Results);
3184
3185/**
3186 * \brief Determine the number of diagnostics produced prior to the
3187 * location where code completion was performed.
3188 */
3189CINDEX_LINKAGE
3190unsigned clang_codeCompleteGetNumDiagnostics(CXCodeCompleteResults *Results);
3191
3192/**
3193 * \brief Retrieve a diagnostic associated with the given code completion.
3194 *
3195 * \param Result the code completion results to query.
3196 * \param Index the zero-based diagnostic number to retrieve.
3197 *
3198 * \returns the requested diagnostic. This diagnostic must be freed
3199 * via a call to \c clang_disposeDiagnostic().
3200 */
3201CINDEX_LINKAGE
3202CXDiagnostic clang_codeCompleteGetDiagnostic(CXCodeCompleteResults *Results,
3203                                             unsigned Index);
3204
3205/**
3206 * \brief Determines what compeltions are appropriate for the context
3207 * the given code completion.
3208 *
3209 * \param Results the code completion results to query
3210 *
3211 * \returns the kinds of completions that are appropriate for use
3212 * along with the given code completion results.
3213 */
3214CINDEX_LINKAGE
3215unsigned long long clang_codeCompleteGetContexts(
3216                                                CXCodeCompleteResults *Results);
3217
3218/**
3219 * \brief Returns the cursor kind for the container for the current code
3220 * completion context. The container is only guaranteed to be set for
3221 * contexts where a container exists (i.e. member accesses or Objective-C
3222 * message sends); if there is not a container, this function will return
3223 * CXCursor_InvalidCode.
3224 *
3225 * \param Results the code completion results to query
3226 *
3227 * \param IsIncomplete on return, this value will be false if Clang has complete
3228 * information about the container. If Clang does not have complete
3229 * information, this value will be true.
3230 *
3231 * \returns the container kind, or CXCursor_InvalidCode if there is not a
3232 * container
3233 */
3234CINDEX_LINKAGE
3235enum CXCursorKind clang_codeCompleteGetContainerKind(
3236                                                 CXCodeCompleteResults *Results,
3237                                                     unsigned *IsIncomplete);
3238
3239/**
3240 * \brief Returns the USR for the container for the current code completion
3241 * context. If there is not a container for the current context, this
3242 * function will return the empty string.
3243 *
3244 * \param Results the code completion results to query
3245 *
3246 * \returns the USR for the container
3247 */
3248CINDEX_LINKAGE
3249CXString clang_codeCompleteGetContainerUSR(CXCodeCompleteResults *Results);
3250
3251
3252/**
3253 * \brief Returns the currently-entered selector for an Objective-C message
3254 * send, formatted like "initWithFoo:bar:". Only guaranteed to return a
3255 * non-empty string for CXCompletionContext_ObjCInstanceMessage and
3256 * CXCompletionContext_ObjCClassMessage.
3257 *
3258 * \param Results the code completion results to query
3259 *
3260 * \returns the selector (or partial selector) that has been entered thus far
3261 * for an Objective-C message send.
3262 */
3263CINDEX_LINKAGE
3264CXString clang_codeCompleteGetObjCSelector(CXCodeCompleteResults *Results);
3265
3266/**
3267 * @}
3268 */
3269
3270
3271/**
3272 * \defgroup CINDEX_MISC Miscellaneous utility functions
3273 *
3274 * @{
3275 */
3276
3277/**
3278 * \brief Return a version string, suitable for showing to a user, but not
3279 *        intended to be parsed (the format is not guaranteed to be stable).
3280 */
3281CINDEX_LINKAGE CXString clang_getClangVersion();
3282
3283
3284/**
3285 * \brief Enable/disable crash recovery.
3286 *
3287 * \param Flag to indicate if crash recovery is enabled.  A non-zero value
3288 *        enables crash recovery, while 0 disables it.
3289 */
3290CINDEX_LINKAGE void clang_toggleCrashRecovery(unsigned isEnabled);
3291
3292 /**
3293  * \brief Visitor invoked for each file in a translation unit
3294  *        (used with clang_getInclusions()).
3295  *
3296  * This visitor function will be invoked by clang_getInclusions() for each
3297  * file included (either at the top-level or by #include directives) within
3298  * a translation unit.  The first argument is the file being included, and
3299  * the second and third arguments provide the inclusion stack.  The
3300  * array is sorted in order of immediate inclusion.  For example,
3301  * the first element refers to the location that included 'included_file'.
3302  */
3303typedef void (*CXInclusionVisitor)(CXFile included_file,
3304                                   CXSourceLocation* inclusion_stack,
3305                                   unsigned include_len,
3306                                   CXClientData client_data);
3307
3308/**
3309 * \brief Visit the set of preprocessor inclusions in a translation unit.
3310 *   The visitor function is called with the provided data for every included
3311 *   file.  This does not include headers included by the PCH file (unless one
3312 *   is inspecting the inclusions in the PCH file itself).
3313 */
3314CINDEX_LINKAGE void clang_getInclusions(CXTranslationUnit tu,
3315                                        CXInclusionVisitor visitor,
3316                                        CXClientData client_data);
3317
3318/**
3319 * @}
3320 */
3321
3322/** \defgroup CINDEX_REMAPPING Remapping functions
3323 *
3324 * @{
3325 */
3326
3327/**
3328 * \brief A remapping of original source files and their translated files.
3329 */
3330typedef void *CXRemapping;
3331
3332/**
3333 * \brief Retrieve a remapping.
3334 *
3335 * \param path the path that contains metadata about remappings.
3336 *
3337 * \returns the requested remapping. This remapping must be freed
3338 * via a call to \c clang_remap_dispose(). Can return NULL if an error occurred.
3339 */
3340CINDEX_LINKAGE CXRemapping clang_getRemappings(const char *path);
3341
3342/**
3343 * \brief Determine the number of remappings.
3344 */
3345CINDEX_LINKAGE unsigned clang_remap_getNumFiles(CXRemapping);
3346
3347/**
3348 * \brief Get the original and the associated filename from the remapping.
3349 *
3350 * \param original If non-NULL, will be set to the original filename.
3351 *
3352 * \param transformed If non-NULL, will be set to the filename that the original
3353 * is associated with.
3354 */
3355CINDEX_LINKAGE void clang_remap_getFilenames(CXRemapping, unsigned index,
3356                                     CXString *original, CXString *transformed);
3357
3358/**
3359 * \brief Dispose the remapping.
3360 */
3361CINDEX_LINKAGE void clang_remap_dispose(CXRemapping);
3362
3363/**
3364 * @}
3365 */
3366
3367/**
3368 * @}
3369 */
3370
3371#ifdef __cplusplus
3372}
3373#endif
3374#endif
3375
3376