1 //===--- USRLocFinder.h - Clang refactoring library -----------------------===//
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
7 //===----------------------------------------------------------------------===//
10 /// Provides functionality for finding all instances of a USR in a given
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
16 #define LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
18 #include "clang/AST/AST.h"
19 #include "clang/Tooling/Core/Replacement.h"
20 #include "clang/Tooling/Refactoring/AtomicChange.h"
21 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
22 #include "llvm/ADT/StringRef.h"
29 /// Create atomic changes for renaming all symbol references which are
30 /// identified by the USRs set to a given new name.
32 /// \param USRs The set containing USRs of a particular old symbol.
33 /// \param NewName The new name to replace old symbol name.
34 /// \param TranslationUnitDecl The translation unit declaration.
36 /// \return Atomic changes for renaming.
37 std::vector<tooling::AtomicChange>
38 createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
39 llvm::StringRef NewName, Decl *TranslationUnitDecl);
41 /// Finds the symbol occurrences for the symbol that's identified by the given
44 /// \return SymbolOccurrences that can be converted to AtomicChanges when
46 SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
47 StringRef PrevName, Decl *Decl);
49 } // end namespace tooling
50 } // end namespace clang
52 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H