clang  14.0.0git
USRLocFinder.h
Go to the documentation of this file.
1 //===--- USRLocFinder.h - Clang refactoring library -----------------------===//
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 /// \file
10 /// Provides functionality for finding all instances of a USR in a given
11 /// AST.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
16 #define LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
17 
18 #include "clang/AST/AST.h"
22 #include "llvm/ADT/StringRef.h"
23 #include <string>
24 #include <vector>
25 
26 namespace clang {
27 namespace tooling {
28 
29 /// Create atomic changes for renaming all symbol references which are
30 /// identified by the USRs set to a given new name.
31 ///
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.
35 ///
36 /// \return Atomic changes for renaming.
37 std::vector<tooling::AtomicChange>
39  llvm::StringRef NewName, Decl *TranslationUnitDecl);
40 
41 /// Finds the symbol occurrences for the symbol that's identified by the given
42 /// USR set.
43 ///
44 /// \return SymbolOccurrences that can be converted to AtomicChanges when
45 /// renaming.
46 SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
47  StringRef PrevName, Decl *Decl);
48 
49 } // end namespace tooling
50 } // end namespace clang
51 
52 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
clang::tooling::getOccurrencesOfUSRs
SymbolOccurrences getOccurrencesOfUSRs(ArrayRef< std::string > USRs, StringRef PrevName, Decl *Decl)
Finds the symbol occurrences for the symbol that's identified by the given USR set.
Definition: USRLocFinder.cpp:520
AtomicChange.h
clang::tooling::createRenameAtomicChanges
std::vector< tooling::AtomicChange > createRenameAtomicChanges(llvm::ArrayRef< std::string > USRs, llvm::StringRef NewName, Decl *TranslationUnitDecl)
Create atomic changes for renaming all symbol references which are identified by the USRs set to a gi...
Definition: USRLocFinder.cpp:528
Replacement.h
llvm::ArrayRef< std::string >
SymbolOccurrences.h
clang
Definition: CalledOnceCheck.h:17
clang::tooling::SymbolOccurrences
std::vector< SymbolOccurrence > SymbolOccurrences
Definition: SymbolOccurrences.h:86
AST.h