Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:11

0001 //===- Mutations.h - mutate syntax trees --------------------*- C++ ---*-=====//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 // Defines high-level APIs for transforming syntax trees and producing the
0009 // corresponding textual replacements.
0010 //===----------------------------------------------------------------------===//
0011 #ifndef LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
0012 #define LLVM_CLANG_TOOLING_SYNTAX_MUTATIONS_H
0013 
0014 #include "clang/Tooling/Core/Replacement.h"
0015 #include "clang/Tooling/Syntax/Nodes.h"
0016 #include "clang/Tooling/Syntax/TokenBufferTokenManager.h"
0017 #include "clang/Tooling/Syntax/Tree.h"
0018 
0019 namespace clang {
0020 namespace syntax {
0021 
0022 /// Computes textual replacements required to mimic the tree modifications made
0023 /// to the syntax tree.
0024 tooling::Replacements computeReplacements(const TokenBufferTokenManager &TBTM,
0025                                           const syntax::TranslationUnit &TU);
0026 
0027 /// Removes a statement or replaces it with an empty statement where one is
0028 /// required syntactically. E.g., in the following example:
0029 ///     if (cond) { foo(); } else bar();
0030 /// One can remove `foo();` completely and to remove `bar();` we would need to
0031 /// replace it with an empty statement.
0032 /// EXPECTS: S->canModify() == true
0033 void removeStatement(syntax::Arena &A, TokenBufferTokenManager &TBTM,
0034                      syntax::Statement *S);
0035 
0036 } // namespace syntax
0037 } // namespace clang
0038 
0039 #endif