clang  14.0.0git
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 
17 
18 namespace clang {
19 namespace syntax {
20 
21 /// Computes textual replacements required to mimic the tree modifications made
22 /// to the syntax tree.
23 tooling::Replacements computeReplacements(const Arena &A,
24  const syntax::TranslationUnit &TU);
25 
26 /// Removes a statement or replaces it with an empty statement where one is
27 /// required syntactically. E.g., in the following example:
28 /// if (cond) { foo(); } else bar();
29 /// One can remove `foo();` completely and to remove `bar();` we would need to
30 /// replace it with an empty statement.
31 /// EXPECTS: S->canModify() == true
32 void removeStatement(syntax::Arena &A, syntax::Statement *S);
33 
34 } // namespace syntax
35 } // namespace clang
36 
37 #endif
clang::syntax::computeReplacements
tooling::Replacements computeReplacements(const Arena &A, const syntax::TranslationUnit &TU)
Computes textual replacements required to mimic the tree modifications made to the syntax tree.
Definition: ComputeReplacements.cpp:86
clang::syntax::removeStatement
void removeStatement(syntax::Arena &A, syntax::Statement *S)
Removes a statement or replaces it with an empty statement where one is required syntactically.
Definition: Mutations.cpp:80
Replacement.h
Tree.h
Nodes.h
clang
Definition: CalledOnceCheck.h:17