Line data Source code
1 : //===--- tools/extra/clang-rename/USRFindingAction.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 find all relevant USRs at a point.
12 : ///
13 : //===----------------------------------------------------------------------===//
14 :
15 : #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H
16 : #define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H
17 :
18 : #include "clang/Basic/LLVM.h"
19 : #include "llvm/ADT/ArrayRef.h"
20 :
21 : #include <string>
22 : #include <vector>
23 :
24 : namespace clang {
25 : class ASTConsumer;
26 : class CompilerInstance;
27 : class NamedDecl;
28 :
29 : namespace rename {
30 :
31 202 : struct USRFindingAction {
32 101 : USRFindingAction(ArrayRef<unsigned> SymbolOffsets,
33 : ArrayRef<std::string> QualifiedNames, bool Force)
34 101 : : SymbolOffsets(SymbolOffsets), QualifiedNames(QualifiedNames),
35 404 : ErrorOccurred(false), Force(Force) {}
36 : std::unique_ptr<ASTConsumer> newASTConsumer();
37 :
38 : ArrayRef<std::string> getUSRSpellings() { return SpellingNames; }
39 202 : ArrayRef<std::vector<std::string>> getUSRList() { return USRList; }
40 : bool errorOccurred() { return ErrorOccurred; }
41 :
42 : private:
43 : std::vector<unsigned> SymbolOffsets;
44 : std::vector<std::string> QualifiedNames;
45 : std::vector<std::string> SpellingNames;
46 : std::vector<std::vector<std::string>> USRList;
47 : bool ErrorOccurred;
48 : bool Force;
49 : };
50 :
51 : } // namespace rename
52 : } // namespace clang
53 :
54 : #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H
|