Go to the documentation of this file.
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
15 #include "clang/Basic/LangOptions.h"
16 #include "clang/Tooling/Core/Replacement.h"
17 #include "llvm/Support/Error.h"
27 llvm::function_ref<llvm::Optional<std::string>(
PathRef AbsPath)>;
68 llvm::StringRef InitialCode,
69 std::vector<Range> Occurrences,
70 llvm::StringRef NewName);
82 llvm::Optional<std::vector<Range>>
84 std::vector<Range> Indexed,
const LangOptions &LangOpts);
92 llvm::Optional<std::vector<Range>>
getMappedRanges(ArrayRef<Range> Indexed,
93 ArrayRef<Range> Lexed);
101 ArrayRef<size_t> MappedIndex);
106 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
llvm::Expected< FileEdits > rename(const RenameInputs &RInputs)
Renames all occurrences of the symbol.
llvm::Expected< Edit > buildRenameEdit(llvm::StringRef AbsFilePath, llvm::StringRef InitialCode, std::vector< Range > Occurrences, llvm::StringRef NewName)
Generates rename edits that replaces all given occurrences with the NewName.
llvm::Optional< std::vector< Range > > getMappedRanges(ArrayRef< Range > Indexed, ArrayRef< Range > Lexed)
Calculates the lexed occurrences that the given indexed occurrences map to.
Interface for symbol indexes that can be used for searching or matching symbols among a set of symbol...
llvm::StringRef PathRef
A typedef to represent a ref to file path.
size_t LimitFiles
The maximum number of affected files (0 means no limit), only meaningful when AllowCrossFile = true.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
size_t renameRangeAdjustmentCost(ArrayRef< Range > Indexed, ArrayRef< Range > Lexed, ArrayRef< size_t > MappedIndex)
Evaluates how good the mapped result is.
llvm::function_ref< llvm::Optional< std::string >(PathRef AbsPath)> DirtyBufferGetter
Gets dirty buffer for a given file AbsPath.
Stores and provides access to parsed AST.
llvm::Optional< std::vector< Range > > adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier, std::vector< Range > Indexed, const LangOptions &LangOpts)
Adjusts indexed occurrences to match the current state of the file.
bool WantFormat
If true, format the rename edits, only meaningful in ClangdServer layer.
bool AllowCrossFile
If true, enable cross-file rename; otherwise, only allows to rename a symbol that's only used in the ...