clang  5.0.0
USRLocFinder.h
Go to the documentation of this file.
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 /// \brief 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"
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 // FIXME: make this an AST matcher. Wouldn't that be awesome??? I agree!
42 std::vector<SourceLocation>
43 getLocationsOfUSRs(const std::vector<std::string> &USRs,
44  llvm::StringRef PrevName, Decl *Decl);
45 
46 } // end namespace tooling
47 } // end namespace clang
48 
49 #endif // LLVM_CLANG_TOOLING_REFACTOR_RENAME_USR_LOC_FINDER_H
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...
std::vector< SourceLocation > getLocationsOfUSRs(const std::vector< std::string > &USRs, llvm::StringRef PrevName, Decl *Decl)
const std::string PrevName