File indexing completed on 2026-05-10 08:37:11
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_EXTRACT_H
0010 #define LLVM_CLANG_TOOLING_REFACTORING_EXTRACT_EXTRACT_H
0011
0012 #include "clang/Tooling/Refactoring/ASTSelection.h"
0013 #include "clang/Tooling/Refactoring/RefactoringActionRules.h"
0014 #include <optional>
0015
0016 namespace clang {
0017 namespace tooling {
0018
0019
0020
0021 class ExtractFunction final : public SourceChangeRefactoringRule {
0022 public:
0023
0024
0025
0026
0027
0028 static Expected<ExtractFunction>
0029 initiate(RefactoringRuleContext &Context, CodeRangeASTSelection Code,
0030 std::optional<std::string> DeclName);
0031
0032 static const RefactoringDescriptor &describe();
0033
0034 private:
0035 ExtractFunction(CodeRangeASTSelection Code,
0036 std::optional<std::string> DeclName)
0037 : Code(std::move(Code)),
0038 DeclName(DeclName ? std::move(*DeclName) : "extracted") {}
0039
0040 Expected<AtomicChanges>
0041 createSourceReplacements(RefactoringRuleContext &Context) override;
0042
0043 CodeRangeASTSelection Code;
0044
0045
0046
0047
0048 std::string DeclName;
0049 };
0050
0051 }
0052 }
0053
0054 #endif