]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/clang/Tooling/Refactoring/Rename/USRLocFinder.h
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / include / clang / Tooling / Refactoring / Rename / USRLocFinder.h
1 //===--- USRLocFinder.h - Clang refactoring library -----------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// \file
11 /// Provides functionality for finding all instances of a USR in a given
12 /// AST.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
17 #define LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
18
19 #include "clang/AST/AST.h"
20 #include "clang/Tooling/Core/Replacement.h"
21 #include "clang/Tooling/Refactoring/AtomicChange.h"
22 #include "clang/Tooling/Refactoring/Rename/SymbolOccurrences.h"
23 #include "llvm/ADT/StringRef.h"
24 #include <string>
25 #include <vector>
26
27 namespace clang {
28 namespace tooling {
29
30 /// Create atomic changes for renaming all symbol references which are
31 /// identified by the USRs set to a given new name.
32 ///
33 /// \param USRs The set containing USRs of a particular old symbol.
34 /// \param NewName The new name to replace old symbol name.
35 /// \param TranslationUnitDecl The translation unit declaration.
36 ///
37 /// \return Atomic changes for renaming.
38 std::vector<tooling::AtomicChange>
39 createRenameAtomicChanges(llvm::ArrayRef<std::string> USRs,
40                           llvm::StringRef NewName, Decl *TranslationUnitDecl);
41
42 /// Finds the symbol occurrences for the symbol that's identified by the given
43 /// USR set.
44 ///
45 /// \return SymbolOccurrences that can be converted to AtomicChanges when
46 /// renaming.
47 SymbolOccurrences getOccurrencesOfUSRs(ArrayRef<std::string> USRs,
48                                        StringRef PrevName, Decl *Decl);
49
50 } // end namespace tooling
51 } // end namespace clang
52
53 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H