clang 10.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"
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"
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>
38 createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
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::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:511
AtomicChange.h
AST.h
llvm::ArrayRef< std::string >
SymbolOccurrences.h
Replacement.h
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::tooling::SymbolOccurrences
std::vector< SymbolOccurrence > SymbolOccurrences
Definition: SymbolOccurrences.h:85
clang::tooling::getOccurrencesOfUSRs
SymbolOccurrences getOccurrencesOfUSRs(ArrayRef< std::string > USRs, StringRef PrevName, Decl *Decl)
Finds the symbol occurrences for the symbol that&#39;s identified by the given USR set.
Definition: USRLocFinder.cpp:503