[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / include / clang-c / Rewrite.h
blobce1b05594b3843dc7cfdd9b1226115d49ddaa441
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 |*===----------------------------------------------------------------------===*/
10 #ifndef LLVM_CLANG_C_REWRITE_H
11 #define LLVM_CLANG_C_REWRITE_H
13 #include "clang-c/CXString.h"
14 #include "clang-c/ExternC.h"
15 #include "clang-c/Index.h"
16 #include "clang-c/Platform.h"
18 LLVM_CLANG_C_EXTERN_C_BEGIN
20 typedef void *CXRewriter;
22 /**
23 * Create CXRewriter.
25 CINDEX_LINKAGE CXRewriter clang_CXRewriter_create(CXTranslationUnit TU);
27 /**
28 * Insert the specified string at the specified location in the original buffer.
30 CINDEX_LINKAGE void clang_CXRewriter_insertTextBefore(CXRewriter Rew, CXSourceLocation Loc,
31 const char *Insert);
33 /**
34 * Replace the specified range of characters in the input with the specified
35 * replacement.
37 CINDEX_LINKAGE void clang_CXRewriter_replaceText(CXRewriter Rew, CXSourceRange ToBeReplaced,
38 const char *Replacement);
40 /**
41 * Remove the specified range.
43 CINDEX_LINKAGE void clang_CXRewriter_removeText(CXRewriter Rew, CXSourceRange ToBeRemoved);
45 /**
46 * Save all changed files to disk.
47 * Returns 1 if any files were not saved successfully, returns 0 otherwise.
49 CINDEX_LINKAGE int clang_CXRewriter_overwriteChangedFiles(CXRewriter Rew);
51 /**
52 * Write out rewritten version of the main file to stdout.
54 CINDEX_LINKAGE void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew);
56 /**
57 * Free the given CXRewriter.
59 CINDEX_LINKAGE void clang_CXRewriter_dispose(CXRewriter Rew);
61 LLVM_CLANG_C_EXTERN_C_END
63 #endif