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)>;
56 llvm::StringRef InitialCode,
57 std::vector<Range> Occurrences,
70 llvm::Optional<std::vector<Range>>
72 std::vector<Range> Indexed,
const LangOptions &LangOpts);
80 llvm::Optional<std::vector<Range>>
getMappedRanges(ArrayRef<Range> Indexed,
81 ArrayRef<Range> Lexed);
89 ArrayRef<size_t> MappedIndex);
94 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H
llvm::Optional< std::vector< Range > > getMappedRanges(ArrayRef< Range > Indexed, ArrayRef< Range > Lexed)
Calculates the lexed occurrences that the given indexed occurrences map to.
llvm::function_ref< llvm::Optional< std::string >(PathRef AbsPath)> DirtyBufferGetter
Gets dirty buffer for a given file AbsPath.
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.
Stores and provides access to parsed AST.
===– 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::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.
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.