clang 19.0.0git
Rewrite.h
Go to the documentation of this file.
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#ifndef LLVM_CLANG_C_REWRITE_H
11#define LLVM_CLANG_C_REWRITE_H
12
13#include "clang-c/CXString.h"
14#include "clang-c/ExternC.h"
15#include "clang-c/Index.h"
16#include "clang-c/Platform.h"
17
19
20typedef void *CXRewriter;
21
22/**
23 * Create CXRewriter.
24 */
26
27/**
28 * Insert the specified string at the specified location in the original buffer.
29 */
31 const char *Insert);
32
33/**
34 * Replace the specified range of characters in the input with the specified
35 * replacement.
36 */
38 const char *Replacement);
39
40/**
41 * Remove the specified range.
42 */
44
45/**
46 * Save all changed files to disk.
47 * Returns 1 if any files were not saved successfully, returns 0 otherwise.
48 */
50
51/**
52 * Write out rewritten version of the main file to stdout.
53 */
55
56/**
57 * Free the given CXRewriter.
58 */
60
62
63#endif
#define LLVM_CLANG_C_EXTERN_C_END
Definition: ExternC.h:36
#define LLVM_CLANG_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define CINDEX_LINKAGE
Definition: Platform.h:38
LLVM_CLANG_C_EXTERN_C_BEGIN typedef void * CXRewriter
Definition: Rewrite.h:20
CINDEX_LINKAGE void clang_CXRewriter_removeText(CXRewriter Rew, CXSourceRange ToBeRemoved)
Remove the specified range.
CINDEX_LINKAGE void clang_CXRewriter_dispose(CXRewriter Rew)
Free the given CXRewriter.
CINDEX_LINKAGE void clang_CXRewriter_replaceText(CXRewriter Rew, CXSourceRange ToBeReplaced, const char *Replacement)
Replace the specified range of characters in the input with the specified replacement.
CINDEX_LINKAGE void clang_CXRewriter_insertTextBefore(CXRewriter Rew, CXSourceLocation Loc, const char *Insert)
Insert the specified string at the specified location in the original buffer.
CINDEX_LINKAGE CXRewriter clang_CXRewriter_create(CXTranslationUnit TU)
Create CXRewriter.
CINDEX_LINKAGE int clang_CXRewriter_overwriteChangedFiles(CXRewriter Rew)
Save all changed files to disk.
CINDEX_LINKAGE void clang_CXRewriter_writeMainFileToStdOut(CXRewriter Rew)
Write out rewritten version of the main file to stdout.
struct CXTranslationUnitImpl * CXTranslationUnit
A single translation unit, which resides in an index.
Definition: Index.h:91
Identifies a specific source location within a translation unit.
Identifies a half-open character range in the source code.