xref: /freebsd/contrib/llvm-project/clang/include/clang-c/CXDiagnostic.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1*bdd1243dSDimitry Andric /*===-- clang-c/CXDiagnostic.h - C Index Diagnostics --------------*- C -*-===*\
2*bdd1243dSDimitry Andric |*                                                                            *|
3*bdd1243dSDimitry Andric |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4*bdd1243dSDimitry Andric |* Exceptions.                                                                *|
5*bdd1243dSDimitry Andric |* See https://llvm.org/LICENSE.txt for license information.                  *|
6*bdd1243dSDimitry Andric |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7*bdd1243dSDimitry Andric |*                                                                            *|
8*bdd1243dSDimitry Andric |*===----------------------------------------------------------------------===*|
9*bdd1243dSDimitry Andric |*                                                                            *|
10*bdd1243dSDimitry Andric |* This header provides the interface to C Index diagnostics.                 *|
11*bdd1243dSDimitry Andric |*                                                                            *|
12*bdd1243dSDimitry Andric \*===----------------------------------------------------------------------===*/
13*bdd1243dSDimitry Andric 
14*bdd1243dSDimitry Andric #ifndef LLVM_CLANG_C_CXDIAGNOSTIC_H
15*bdd1243dSDimitry Andric #define LLVM_CLANG_C_CXDIAGNOSTIC_H
16*bdd1243dSDimitry Andric 
17*bdd1243dSDimitry Andric #include "clang-c/CXSourceLocation.h"
18*bdd1243dSDimitry Andric #include "clang-c/CXString.h"
19*bdd1243dSDimitry Andric #include "clang-c/ExternC.h"
20*bdd1243dSDimitry Andric #include "clang-c/Platform.h"
21*bdd1243dSDimitry Andric 
22*bdd1243dSDimitry Andric LLVM_CLANG_C_EXTERN_C_BEGIN
23*bdd1243dSDimitry Andric 
24*bdd1243dSDimitry Andric /**
25*bdd1243dSDimitry Andric  * \defgroup CINDEX_DIAG Diagnostic reporting
26*bdd1243dSDimitry Andric  *
27*bdd1243dSDimitry Andric  * @{
28*bdd1243dSDimitry Andric  */
29*bdd1243dSDimitry Andric 
30*bdd1243dSDimitry Andric /**
31*bdd1243dSDimitry Andric  * Describes the severity of a particular diagnostic.
32*bdd1243dSDimitry Andric  */
33*bdd1243dSDimitry Andric enum CXDiagnosticSeverity {
34*bdd1243dSDimitry Andric   /**
35*bdd1243dSDimitry Andric    * A diagnostic that has been suppressed, e.g., by a command-line
36*bdd1243dSDimitry Andric    * option.
37*bdd1243dSDimitry Andric    */
38*bdd1243dSDimitry Andric   CXDiagnostic_Ignored = 0,
39*bdd1243dSDimitry Andric 
40*bdd1243dSDimitry Andric   /**
41*bdd1243dSDimitry Andric    * This diagnostic is a note that should be attached to the
42*bdd1243dSDimitry Andric    * previous (non-note) diagnostic.
43*bdd1243dSDimitry Andric    */
44*bdd1243dSDimitry Andric   CXDiagnostic_Note = 1,
45*bdd1243dSDimitry Andric 
46*bdd1243dSDimitry Andric   /**
47*bdd1243dSDimitry Andric    * This diagnostic indicates suspicious code that may not be
48*bdd1243dSDimitry Andric    * wrong.
49*bdd1243dSDimitry Andric    */
50*bdd1243dSDimitry Andric   CXDiagnostic_Warning = 2,
51*bdd1243dSDimitry Andric 
52*bdd1243dSDimitry Andric   /**
53*bdd1243dSDimitry Andric    * This diagnostic indicates that the code is ill-formed.
54*bdd1243dSDimitry Andric    */
55*bdd1243dSDimitry Andric   CXDiagnostic_Error = 3,
56*bdd1243dSDimitry Andric 
57*bdd1243dSDimitry Andric   /**
58*bdd1243dSDimitry Andric    * This diagnostic indicates that the code is ill-formed such
59*bdd1243dSDimitry Andric    * that future parser recovery is unlikely to produce useful
60*bdd1243dSDimitry Andric    * results.
61*bdd1243dSDimitry Andric    */
62*bdd1243dSDimitry Andric   CXDiagnostic_Fatal = 4
63*bdd1243dSDimitry Andric };
64*bdd1243dSDimitry Andric 
65*bdd1243dSDimitry Andric /**
66*bdd1243dSDimitry Andric  * A single diagnostic, containing the diagnostic's severity,
67*bdd1243dSDimitry Andric  * location, text, source ranges, and fix-it hints.
68*bdd1243dSDimitry Andric  */
69*bdd1243dSDimitry Andric typedef void *CXDiagnostic;
70*bdd1243dSDimitry Andric 
71*bdd1243dSDimitry Andric /**
72*bdd1243dSDimitry Andric  * A group of CXDiagnostics.
73*bdd1243dSDimitry Andric  */
74*bdd1243dSDimitry Andric typedef void *CXDiagnosticSet;
75*bdd1243dSDimitry Andric 
76*bdd1243dSDimitry Andric /**
77*bdd1243dSDimitry Andric  * Determine the number of diagnostics in a CXDiagnosticSet.
78*bdd1243dSDimitry Andric  */
79*bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_getNumDiagnosticsInSet(CXDiagnosticSet Diags);
80*bdd1243dSDimitry Andric 
81*bdd1243dSDimitry Andric /**
82*bdd1243dSDimitry Andric  * Retrieve a diagnostic associated with the given CXDiagnosticSet.
83*bdd1243dSDimitry Andric  *
84*bdd1243dSDimitry Andric  * \param Diags the CXDiagnosticSet to query.
85*bdd1243dSDimitry Andric  * \param Index the zero-based diagnostic number to retrieve.
86*bdd1243dSDimitry Andric  *
87*bdd1243dSDimitry Andric  * \returns the requested diagnostic. This diagnostic must be freed
88*bdd1243dSDimitry Andric  * via a call to \c clang_disposeDiagnostic().
89*bdd1243dSDimitry Andric  */
90*bdd1243dSDimitry Andric CINDEX_LINKAGE CXDiagnostic clang_getDiagnosticInSet(CXDiagnosticSet Diags,
91*bdd1243dSDimitry Andric                                                      unsigned Index);
92*bdd1243dSDimitry Andric 
93*bdd1243dSDimitry Andric /**
94*bdd1243dSDimitry Andric  * Describes the kind of error that occurred (if any) in a call to
95*bdd1243dSDimitry Andric  * \c clang_loadDiagnostics.
96*bdd1243dSDimitry Andric  */
97*bdd1243dSDimitry Andric enum CXLoadDiag_Error {
98*bdd1243dSDimitry Andric   /**
99*bdd1243dSDimitry Andric    * Indicates that no error occurred.
100*bdd1243dSDimitry Andric    */
101*bdd1243dSDimitry Andric   CXLoadDiag_None = 0,
102*bdd1243dSDimitry Andric 
103*bdd1243dSDimitry Andric   /**
104*bdd1243dSDimitry Andric    * Indicates that an unknown error occurred while attempting to
105*bdd1243dSDimitry Andric    * deserialize diagnostics.
106*bdd1243dSDimitry Andric    */
107*bdd1243dSDimitry Andric   CXLoadDiag_Unknown = 1,
108*bdd1243dSDimitry Andric 
109*bdd1243dSDimitry Andric   /**
110*bdd1243dSDimitry Andric    * Indicates that the file containing the serialized diagnostics
111*bdd1243dSDimitry Andric    * could not be opened.
112*bdd1243dSDimitry Andric    */
113*bdd1243dSDimitry Andric   CXLoadDiag_CannotLoad = 2,
114*bdd1243dSDimitry Andric 
115*bdd1243dSDimitry Andric   /**
116*bdd1243dSDimitry Andric    * Indicates that the serialized diagnostics file is invalid or
117*bdd1243dSDimitry Andric    * corrupt.
118*bdd1243dSDimitry Andric    */
119*bdd1243dSDimitry Andric   CXLoadDiag_InvalidFile = 3
120*bdd1243dSDimitry Andric };
121*bdd1243dSDimitry Andric 
122*bdd1243dSDimitry Andric /**
123*bdd1243dSDimitry Andric  * Deserialize a set of diagnostics from a Clang diagnostics bitcode
124*bdd1243dSDimitry Andric  * file.
125*bdd1243dSDimitry Andric  *
126*bdd1243dSDimitry Andric  * \param file The name of the file to deserialize.
127*bdd1243dSDimitry Andric  * \param error A pointer to a enum value recording if there was a problem
128*bdd1243dSDimitry Andric  *        deserializing the diagnostics.
129*bdd1243dSDimitry Andric  * \param errorString A pointer to a CXString for recording the error string
130*bdd1243dSDimitry Andric  *        if the file was not successfully loaded.
131*bdd1243dSDimitry Andric  *
132*bdd1243dSDimitry Andric  * \returns A loaded CXDiagnosticSet if successful, and NULL otherwise.  These
133*bdd1243dSDimitry Andric  * diagnostics should be released using clang_disposeDiagnosticSet().
134*bdd1243dSDimitry Andric  */
135*bdd1243dSDimitry Andric CINDEX_LINKAGE CXDiagnosticSet clang_loadDiagnostics(
136*bdd1243dSDimitry Andric     const char *file, enum CXLoadDiag_Error *error, CXString *errorString);
137*bdd1243dSDimitry Andric 
138*bdd1243dSDimitry Andric /**
139*bdd1243dSDimitry Andric  * Release a CXDiagnosticSet and all of its contained diagnostics.
140*bdd1243dSDimitry Andric  */
141*bdd1243dSDimitry Andric CINDEX_LINKAGE void clang_disposeDiagnosticSet(CXDiagnosticSet Diags);
142*bdd1243dSDimitry Andric 
143*bdd1243dSDimitry Andric /**
144*bdd1243dSDimitry Andric  * Retrieve the child diagnostics of a CXDiagnostic.
145*bdd1243dSDimitry Andric  *
146*bdd1243dSDimitry Andric  * This CXDiagnosticSet does not need to be released by
147*bdd1243dSDimitry Andric  * clang_disposeDiagnosticSet.
148*bdd1243dSDimitry Andric  */
149*bdd1243dSDimitry Andric CINDEX_LINKAGE CXDiagnosticSet clang_getChildDiagnostics(CXDiagnostic D);
150*bdd1243dSDimitry Andric 
151*bdd1243dSDimitry Andric /**
152*bdd1243dSDimitry Andric  * Destroy a diagnostic.
153*bdd1243dSDimitry Andric  */
154*bdd1243dSDimitry Andric CINDEX_LINKAGE void clang_disposeDiagnostic(CXDiagnostic Diagnostic);
155*bdd1243dSDimitry Andric 
156*bdd1243dSDimitry Andric /**
157*bdd1243dSDimitry Andric  * Options to control the display of diagnostics.
158*bdd1243dSDimitry Andric  *
159*bdd1243dSDimitry Andric  * The values in this enum are meant to be combined to customize the
160*bdd1243dSDimitry Andric  * behavior of \c clang_formatDiagnostic().
161*bdd1243dSDimitry Andric  */
162*bdd1243dSDimitry Andric enum CXDiagnosticDisplayOptions {
163*bdd1243dSDimitry Andric   /**
164*bdd1243dSDimitry Andric    * Display the source-location information where the
165*bdd1243dSDimitry Andric    * diagnostic was located.
166*bdd1243dSDimitry Andric    *
167*bdd1243dSDimitry Andric    * When set, diagnostics will be prefixed by the file, line, and
168*bdd1243dSDimitry Andric    * (optionally) column to which the diagnostic refers. For example,
169*bdd1243dSDimitry Andric    *
170*bdd1243dSDimitry Andric    * \code
171*bdd1243dSDimitry Andric    * test.c:28: warning: extra tokens at end of #endif directive
172*bdd1243dSDimitry Andric    * \endcode
173*bdd1243dSDimitry Andric    *
174*bdd1243dSDimitry Andric    * This option corresponds to the clang flag \c -fshow-source-location.
175*bdd1243dSDimitry Andric    */
176*bdd1243dSDimitry Andric   CXDiagnostic_DisplaySourceLocation = 0x01,
177*bdd1243dSDimitry Andric 
178*bdd1243dSDimitry Andric   /**
179*bdd1243dSDimitry Andric    * If displaying the source-location information of the
180*bdd1243dSDimitry Andric    * diagnostic, also include the column number.
181*bdd1243dSDimitry Andric    *
182*bdd1243dSDimitry Andric    * This option corresponds to the clang flag \c -fshow-column.
183*bdd1243dSDimitry Andric    */
184*bdd1243dSDimitry Andric   CXDiagnostic_DisplayColumn = 0x02,
185*bdd1243dSDimitry Andric 
186*bdd1243dSDimitry Andric   /**
187*bdd1243dSDimitry Andric    * If displaying the source-location information of the
188*bdd1243dSDimitry Andric    * diagnostic, also include information about source ranges in a
189*bdd1243dSDimitry Andric    * machine-parsable format.
190*bdd1243dSDimitry Andric    *
191*bdd1243dSDimitry Andric    * This option corresponds to the clang flag
192*bdd1243dSDimitry Andric    * \c -fdiagnostics-print-source-range-info.
193*bdd1243dSDimitry Andric    */
194*bdd1243dSDimitry Andric   CXDiagnostic_DisplaySourceRanges = 0x04,
195*bdd1243dSDimitry Andric 
196*bdd1243dSDimitry Andric   /**
197*bdd1243dSDimitry Andric    * Display the option name associated with this diagnostic, if any.
198*bdd1243dSDimitry Andric    *
199*bdd1243dSDimitry Andric    * The option name displayed (e.g., -Wconversion) will be placed in brackets
200*bdd1243dSDimitry Andric    * after the diagnostic text. This option corresponds to the clang flag
201*bdd1243dSDimitry Andric    * \c -fdiagnostics-show-option.
202*bdd1243dSDimitry Andric    */
203*bdd1243dSDimitry Andric   CXDiagnostic_DisplayOption = 0x08,
204*bdd1243dSDimitry Andric 
205*bdd1243dSDimitry Andric   /**
206*bdd1243dSDimitry Andric    * Display the category number associated with this diagnostic, if any.
207*bdd1243dSDimitry Andric    *
208*bdd1243dSDimitry Andric    * The category number is displayed within brackets after the diagnostic text.
209*bdd1243dSDimitry Andric    * This option corresponds to the clang flag
210*bdd1243dSDimitry Andric    * \c -fdiagnostics-show-category=id.
211*bdd1243dSDimitry Andric    */
212*bdd1243dSDimitry Andric   CXDiagnostic_DisplayCategoryId = 0x10,
213*bdd1243dSDimitry Andric 
214*bdd1243dSDimitry Andric   /**
215*bdd1243dSDimitry Andric    * Display the category name associated with this diagnostic, if any.
216*bdd1243dSDimitry Andric    *
217*bdd1243dSDimitry Andric    * The category name is displayed within brackets after the diagnostic text.
218*bdd1243dSDimitry Andric    * This option corresponds to the clang flag
219*bdd1243dSDimitry Andric    * \c -fdiagnostics-show-category=name.
220*bdd1243dSDimitry Andric    */
221*bdd1243dSDimitry Andric   CXDiagnostic_DisplayCategoryName = 0x20
222*bdd1243dSDimitry Andric };
223*bdd1243dSDimitry Andric 
224*bdd1243dSDimitry Andric /**
225*bdd1243dSDimitry Andric  * Format the given diagnostic in a manner that is suitable for display.
226*bdd1243dSDimitry Andric  *
227*bdd1243dSDimitry Andric  * This routine will format the given diagnostic to a string, rendering
228*bdd1243dSDimitry Andric  * the diagnostic according to the various options given. The
229*bdd1243dSDimitry Andric  * \c clang_defaultDiagnosticDisplayOptions() function returns the set of
230*bdd1243dSDimitry Andric  * options that most closely mimics the behavior of the clang compiler.
231*bdd1243dSDimitry Andric  *
232*bdd1243dSDimitry Andric  * \param Diagnostic The diagnostic to print.
233*bdd1243dSDimitry Andric  *
234*bdd1243dSDimitry Andric  * \param Options A set of options that control the diagnostic display,
235*bdd1243dSDimitry Andric  * created by combining \c CXDiagnosticDisplayOptions values.
236*bdd1243dSDimitry Andric  *
237*bdd1243dSDimitry Andric  * \returns A new string containing for formatted diagnostic.
238*bdd1243dSDimitry Andric  */
239*bdd1243dSDimitry Andric CINDEX_LINKAGE CXString clang_formatDiagnostic(CXDiagnostic Diagnostic,
240*bdd1243dSDimitry Andric                                                unsigned Options);
241*bdd1243dSDimitry Andric 
242*bdd1243dSDimitry Andric /**
243*bdd1243dSDimitry Andric  * Retrieve the set of display options most similar to the
244*bdd1243dSDimitry Andric  * default behavior of the clang compiler.
245*bdd1243dSDimitry Andric  *
246*bdd1243dSDimitry Andric  * \returns A set of display options suitable for use with \c
247*bdd1243dSDimitry Andric  * clang_formatDiagnostic().
248*bdd1243dSDimitry Andric  */
249*bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_defaultDiagnosticDisplayOptions(void);
250*bdd1243dSDimitry Andric 
251*bdd1243dSDimitry Andric /**
252*bdd1243dSDimitry Andric  * Determine the severity of the given diagnostic.
253*bdd1243dSDimitry Andric  */
254*bdd1243dSDimitry Andric CINDEX_LINKAGE enum CXDiagnosticSeverity
255*bdd1243dSDimitry Andric     clang_getDiagnosticSeverity(CXDiagnostic);
256*bdd1243dSDimitry Andric 
257*bdd1243dSDimitry Andric /**
258*bdd1243dSDimitry Andric  * Retrieve the source location of the given diagnostic.
259*bdd1243dSDimitry Andric  *
260*bdd1243dSDimitry Andric  * This location is where Clang would print the caret ('^') when
261*bdd1243dSDimitry Andric  * displaying the diagnostic on the command line.
262*bdd1243dSDimitry Andric  */
263*bdd1243dSDimitry Andric CINDEX_LINKAGE CXSourceLocation clang_getDiagnosticLocation(CXDiagnostic);
264*bdd1243dSDimitry Andric 
265*bdd1243dSDimitry Andric /**
266*bdd1243dSDimitry Andric  * Retrieve the text of the given diagnostic.
267*bdd1243dSDimitry Andric  */
268*bdd1243dSDimitry Andric CINDEX_LINKAGE CXString clang_getDiagnosticSpelling(CXDiagnostic);
269*bdd1243dSDimitry Andric 
270*bdd1243dSDimitry Andric /**
271*bdd1243dSDimitry Andric  * Retrieve the name of the command-line option that enabled this
272*bdd1243dSDimitry Andric  * diagnostic.
273*bdd1243dSDimitry Andric  *
274*bdd1243dSDimitry Andric  * \param Diag The diagnostic to be queried.
275*bdd1243dSDimitry Andric  *
276*bdd1243dSDimitry Andric  * \param Disable If non-NULL, will be set to the option that disables this
277*bdd1243dSDimitry Andric  * diagnostic (if any).
278*bdd1243dSDimitry Andric  *
279*bdd1243dSDimitry Andric  * \returns A string that contains the command-line option used to enable this
280*bdd1243dSDimitry Andric  * warning, such as "-Wconversion" or "-pedantic".
281*bdd1243dSDimitry Andric  */
282*bdd1243dSDimitry Andric CINDEX_LINKAGE CXString clang_getDiagnosticOption(CXDiagnostic Diag,
283*bdd1243dSDimitry Andric                                                   CXString *Disable);
284*bdd1243dSDimitry Andric 
285*bdd1243dSDimitry Andric /**
286*bdd1243dSDimitry Andric  * Retrieve the category number for this diagnostic.
287*bdd1243dSDimitry Andric  *
288*bdd1243dSDimitry Andric  * Diagnostics can be categorized into groups along with other, related
289*bdd1243dSDimitry Andric  * diagnostics (e.g., diagnostics under the same warning flag). This routine
290*bdd1243dSDimitry Andric  * retrieves the category number for the given diagnostic.
291*bdd1243dSDimitry Andric  *
292*bdd1243dSDimitry Andric  * \returns The number of the category that contains this diagnostic, or zero
293*bdd1243dSDimitry Andric  * if this diagnostic is uncategorized.
294*bdd1243dSDimitry Andric  */
295*bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_getDiagnosticCategory(CXDiagnostic);
296*bdd1243dSDimitry Andric 
297*bdd1243dSDimitry Andric /**
298*bdd1243dSDimitry Andric  * Retrieve the name of a particular diagnostic category.  This
299*bdd1243dSDimitry Andric  *  is now deprecated.  Use clang_getDiagnosticCategoryText()
300*bdd1243dSDimitry Andric  *  instead.
301*bdd1243dSDimitry Andric  *
302*bdd1243dSDimitry Andric  * \param Category A diagnostic category number, as returned by
303*bdd1243dSDimitry Andric  * \c clang_getDiagnosticCategory().
304*bdd1243dSDimitry Andric  *
305*bdd1243dSDimitry Andric  * \returns The name of the given diagnostic category.
306*bdd1243dSDimitry Andric  */
307*bdd1243dSDimitry Andric CINDEX_DEPRECATED CINDEX_LINKAGE CXString
308*bdd1243dSDimitry Andric clang_getDiagnosticCategoryName(unsigned Category);
309*bdd1243dSDimitry Andric 
310*bdd1243dSDimitry Andric /**
311*bdd1243dSDimitry Andric  * Retrieve the diagnostic category text for a given diagnostic.
312*bdd1243dSDimitry Andric  *
313*bdd1243dSDimitry Andric  * \returns The text of the given diagnostic category.
314*bdd1243dSDimitry Andric  */
315*bdd1243dSDimitry Andric CINDEX_LINKAGE CXString clang_getDiagnosticCategoryText(CXDiagnostic);
316*bdd1243dSDimitry Andric 
317*bdd1243dSDimitry Andric /**
318*bdd1243dSDimitry Andric  * Determine the number of source ranges associated with the given
319*bdd1243dSDimitry Andric  * diagnostic.
320*bdd1243dSDimitry Andric  */
321*bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_getDiagnosticNumRanges(CXDiagnostic);
322*bdd1243dSDimitry Andric 
323*bdd1243dSDimitry Andric /**
324*bdd1243dSDimitry Andric  * Retrieve a source range associated with the diagnostic.
325*bdd1243dSDimitry Andric  *
326*bdd1243dSDimitry Andric  * A diagnostic's source ranges highlight important elements in the source
327*bdd1243dSDimitry Andric  * code. On the command line, Clang displays source ranges by
328*bdd1243dSDimitry Andric  * underlining them with '~' characters.
329*bdd1243dSDimitry Andric  *
330*bdd1243dSDimitry Andric  * \param Diagnostic the diagnostic whose range is being extracted.
331*bdd1243dSDimitry Andric  *
332*bdd1243dSDimitry Andric  * \param Range the zero-based index specifying which range to
333*bdd1243dSDimitry Andric  *
334*bdd1243dSDimitry Andric  * \returns the requested source range.
335*bdd1243dSDimitry Andric  */
336*bdd1243dSDimitry Andric CINDEX_LINKAGE CXSourceRange clang_getDiagnosticRange(CXDiagnostic Diagnostic,
337*bdd1243dSDimitry Andric                                                       unsigned Range);
338*bdd1243dSDimitry Andric 
339*bdd1243dSDimitry Andric /**
340*bdd1243dSDimitry Andric  * Determine the number of fix-it hints associated with the
341*bdd1243dSDimitry Andric  * given diagnostic.
342*bdd1243dSDimitry Andric  */
343*bdd1243dSDimitry Andric CINDEX_LINKAGE unsigned clang_getDiagnosticNumFixIts(CXDiagnostic Diagnostic);
344*bdd1243dSDimitry Andric 
345*bdd1243dSDimitry Andric /**
346*bdd1243dSDimitry Andric  * Retrieve the replacement information for a given fix-it.
347*bdd1243dSDimitry Andric  *
348*bdd1243dSDimitry Andric  * Fix-its are described in terms of a source range whose contents
349*bdd1243dSDimitry Andric  * should be replaced by a string. This approach generalizes over
350*bdd1243dSDimitry Andric  * three kinds of operations: removal of source code (the range covers
351*bdd1243dSDimitry Andric  * the code to be removed and the replacement string is empty),
352*bdd1243dSDimitry Andric  * replacement of source code (the range covers the code to be
353*bdd1243dSDimitry Andric  * replaced and the replacement string provides the new code), and
354*bdd1243dSDimitry Andric  * insertion (both the start and end of the range point at the
355*bdd1243dSDimitry Andric  * insertion location, and the replacement string provides the text to
356*bdd1243dSDimitry Andric  * insert).
357*bdd1243dSDimitry Andric  *
358*bdd1243dSDimitry Andric  * \param Diagnostic The diagnostic whose fix-its are being queried.
359*bdd1243dSDimitry Andric  *
360*bdd1243dSDimitry Andric  * \param FixIt The zero-based index of the fix-it.
361*bdd1243dSDimitry Andric  *
362*bdd1243dSDimitry Andric  * \param ReplacementRange The source range whose contents will be
363*bdd1243dSDimitry Andric  * replaced with the returned replacement string. Note that source
364*bdd1243dSDimitry Andric  * ranges are half-open ranges [a, b), so the source code should be
365*bdd1243dSDimitry Andric  * replaced from a and up to (but not including) b.
366*bdd1243dSDimitry Andric  *
367*bdd1243dSDimitry Andric  * \returns A string containing text that should be replace the source
368*bdd1243dSDimitry Andric  * code indicated by the \c ReplacementRange.
369*bdd1243dSDimitry Andric  */
370*bdd1243dSDimitry Andric CINDEX_LINKAGE CXString clang_getDiagnosticFixIt(
371*bdd1243dSDimitry Andric     CXDiagnostic Diagnostic, unsigned FixIt, CXSourceRange *ReplacementRange);
372*bdd1243dSDimitry Andric 
373*bdd1243dSDimitry Andric /**
374*bdd1243dSDimitry Andric  * @}
375*bdd1243dSDimitry Andric  */
376*bdd1243dSDimitry Andric 
377*bdd1243dSDimitry Andric LLVM_CLANG_C_EXTERN_C_END
378*bdd1243dSDimitry Andric 
379*bdd1243dSDimitry Andric #endif
380