1 /*===-- clang-c/Rewrite.h - C CXRewriter   --------------------------*- C -*-===*\
2 |*                                                                            *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4 |* Exceptions.                                                                *|
5 |* See https://llvm.org/LICENSE.txt for license information.                  *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7 |*                                                                            *|
8 |*===----------------------------------------------------------------------===*/
9 
10 module clang.c.Rewrite;
11 
12 public import clang.c.Index;
13 
14 extern (C):
15 
16 alias CXRewriter = void*;
17 
18 /**
19  * Create CXRewriter.
20  */
21 CXRewriter clang_CXRewriter_create(CXTranslationUnit TU);
22 
23 /**
24  * Insert the specified string at the specified location in the original buffer.
25  */
26 void clang_CXRewriter_insertTextBefore(
27     CXRewriter Rew,
28     CXSourceLocation Loc,
29     const(char)* Insert);
30 
31 /**
32  * Replace the specified range of characters in the input with the specified
33  * replacement.
34  */
35 void clang_CXRewriter_replaceText(
36     CXRewriter Rew,
37     CXSourceRange ToBeReplaced,
38     const(char)* Replacement);
39 
40 /**
41  * Remove the specified range.
42  */
43 void clang_CXRewriter_removeText(CXRewriter Rew, CXSourceRange ToBeRemoved);
44 
45 /**
46  * Save all changed files to disk.
47  * Returns 1 if any files were not saved successfully, returns 0 otherwise.
48  */
49 int clang_CXRewriter_overwriteChangedFiles(CXRewriter Rew);
50 
51 /**
52  * Write out rewritten version of the main file to stdout.
53  */
54 void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew);
55 
56 /**
57  * Free the given CXRewriter.
58  */
59 void clang_CXRewriter_dispose(CXRewriter Rew);
60