clang-tools  4.0.0
RenamingAction.h
Go to the documentation of this file.
1 //===--- tools/extra/clang-rename/RenamingAction.h - Clang rename tool ----===//
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 an action to rename every symbol at a point.
12 ///
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_RENAMING_ACTION_H
16 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_RENAMING_ACTION_H
17 
18 #include "clang/Tooling/Refactoring.h"
19 
20 namespace clang {
21 class ASTConsumer;
22 class CompilerInstance;
23 
24 namespace rename {
25 
27 public:
28  RenamingAction(const std::vector<std::string> &NewNames,
29  const std::vector<std::string> &PrevNames,
30  const std::vector<std::vector<std::string>> &USRList,
31  std::map<std::string, tooling::Replacements> &FileToReplaces,
32  bool PrintLocations = false)
33  : NewNames(NewNames), PrevNames(PrevNames), USRList(USRList),
34  FileToReplaces(FileToReplaces), PrintLocations(PrintLocations) {}
35 
36  std::unique_ptr<ASTConsumer> newASTConsumer();
37 
38 private:
39  const std::vector<std::string> &NewNames, &PrevNames;
40  const std::vector<std::vector<std::string>> &USRList;
41  std::map<std::string, tooling::Replacements> &FileToReplaces;
42  bool PrintLocations;
43 };
44 
45 } // namespace rename
46 } // namespace clang
47 
48 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_RENAMING_ACTION_H
std::unique_ptr< ASTConsumer > newASTConsumer()
RenamingAction(const std::vector< std::string > &NewNames, const std::vector< std::string > &PrevNames, const std::vector< std::vector< std::string >> &USRList, std::map< std::string, tooling::Replacements > &FileToReplaces, bool PrintLocations=false)