clang
22.0.0git
include
clang
Tooling
Syntax
Mutations.h
Go to the documentation of this file.
1
//===- Mutations.h - mutate syntax trees --------------------*- C++ ---*-=====//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
// Defines high-level APIs for transforming syntax trees and producing the
9
// corresponding textual replacements.
10
//===----------------------------------------------------------------------===//
11
#ifndef LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
12
#define LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
13
14
#include "
clang/Tooling/Core/Replacement.h
"
15
#include "
clang/Tooling/Syntax/Nodes.h
"
16
#include "
clang/Tooling/Syntax/TokenBufferTokenManager.h
"
17
#include "
clang/Tooling/Syntax/Tree.h
"
18
19
namespace
clang
{
20
namespace
syntax
{
21
22
/// Computes textual replacements required to mimic the tree modifications made
23
/// to the syntax tree.
24
tooling::Replacements
computeReplacements
(
const
TokenBufferTokenManager
&TBTM,
25
const
syntax::TranslationUnit &TU);
26
27
/// Removes a statement or replaces it with an empty statement where one is
28
/// required syntactically. E.g., in the following example:
29
/// if (cond) { foo(); } else bar();
30
/// One can remove `foo();` completely and to remove `bar();` we would need to
31
/// replace it with an empty statement.
32
/// EXPECTS: S->canModify() == true
33
void
removeStatement
(syntax::Arena &A,
TokenBufferTokenManager
&TBTM,
34
syntax::Statement
*S);
35
36
}
// namespace syntax
37
}
// namespace clang
38
39
#endif
Nodes.h
Replacement.h
TokenBufferTokenManager.h
Tree.h
clang::syntax::TokenBufferTokenManager
A TokenBuffer-powered token manager.
Definition
TokenBufferTokenManager.h:20
clang::syntax
Definition
BuildTree.h:20
clang::syntax::NodeRole::Statement
@ Statement
Definition
Nodes.h:91
clang::syntax::removeStatement
void removeStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM, syntax::Statement *S)
Removes a statement or replaces it with an empty statement where one is required syntactically.
Definition
Mutations.cpp:71
clang::syntax::computeReplacements
tooling::Replacements computeReplacements(const TokenBufferTokenManager &TBTM, const syntax::TranslationUnit &TU)
Computes textual replacements required to mimic the tree modifications made to the syntax tree.
Definition
ComputeReplacements.cpp:93
clang
The JSON file list parser is used to communicate input to InstallAPI.
Definition
CalledOnceCheck.h:17
Generated on
for clang by
1.14.0