1 /*===-- clang-c/Rewrite.h - C CXRewriter --------------------------*- C -*-===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
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
;
25 CINDEX_LINKAGE CXRewriter
clang_CXRewriter_create(CXTranslationUnit TU
);
28 * Insert the specified string at the specified location in the original buffer.
30 CINDEX_LINKAGE
void clang_CXRewriter_insertTextBefore(CXRewriter Rew
, CXSourceLocation Loc
,
34 * Replace the specified range of characters in the input with the specified
37 CINDEX_LINKAGE
void clang_CXRewriter_replaceText(CXRewriter Rew
, CXSourceRange ToBeReplaced
,
38 const char *Replacement
);
41 * Remove the specified range.
43 CINDEX_LINKAGE
void clang_CXRewriter_removeText(CXRewriter Rew
, CXSourceRange ToBeRemoved
);
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
);
52 * Write out rewritten version of the main file to stdout.
54 CINDEX_LINKAGE
void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew
);
57 * Free the given CXRewriter.
59 CINDEX_LINKAGE
void clang_CXRewriter_dispose(CXRewriter Rew
);
61 LLVM_CLANG_C_EXTERN_C_END