1 //===--- Rename.h - Symbol-rename refactorings -------------------*- 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 9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H 10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H 11 12 #include "ClangdUnit.h" 13 #include "clang/Tooling/Core/Replacement.h" 14 #include "llvm/Support/Error.h" 15 16 namespace clang { 17 namespace clangd { 18 19 /// Renames all occurrences of the symbol at \p Pos to \p NewName. 20 /// Occurrences outside the current file are not modified. 21 /// Returns an error if rename a symbol that's used in another file (per the 22 /// index). 23 llvm::Expected<tooling::Replacements> 24 renameWithinFile(ParsedAST &AST, llvm::StringRef File, Position Pos, 25 llvm::StringRef NewName, const SymbolIndex *Index = nullptr); 26 27 } // namespace clangd 28 } // namespace clang 29 30 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_REFACTOR_RENAME_H 31