blob: 42c233d1ed9537bf2d0e6faa97e6dd8ee5179ddb [file] [log] [blame]
Manuel Klimekde237262014-08-20 01:39:05 +00001//===--- 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
Kirill Bobyrev32db7692016-07-15 11:29:16 +000011/// \brief Provides an action to find all relevant USRs at a point.
Manuel Klimekde237262014-08-20 01:39:05 +000012///
13//===----------------------------------------------------------------------===//
14
Kirill Bobyrev405699e2016-08-19 09:36:14 +000015#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H
16#define LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H
Manuel Klimekde237262014-08-20 01:39:05 +000017
Kirill Bobyreve5e7e152016-09-16 08:45:19 +000018#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/ArrayRef.h"
20
21#include <string>
22#include <vector>
Manuel Klimekde237262014-08-20 01:39:05 +000023
24namespace clang {
25class ASTConsumer;
26class CompilerInstance;
27class NamedDecl;
28
29namespace rename {
30
31struct USRFindingAction {
Kirill Bobyreve5e7e152016-09-16 08:45:19 +000032 USRFindingAction(ArrayRef<unsigned> SymbolOffsets,
33 ArrayRef<std::string> QualifiedNames)
34 : SymbolOffsets(SymbolOffsets), QualifiedNames(QualifiedNames),
35 ErrorOccurred(false) {}
Manuel Klimekde237262014-08-20 01:39:05 +000036 std::unique_ptr<ASTConsumer> newASTConsumer();
37
Kirill Bobyreve5e7e152016-09-16 08:45:19 +000038 ArrayRef<std::string> getUSRSpellings() { return SpellingNames; }
39 ArrayRef<std::vector<std::string>> getUSRList() { return USRList; }
40 bool errorOccurred() { return ErrorOccurred; }
Manuel Klimekde237262014-08-20 01:39:05 +000041
42private:
Kirill Bobyreve5e7e152016-09-16 08:45:19 +000043 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;
Manuel Klimekde237262014-08-20 01:39:05 +000048};
49
Kirill Bobyrev32db7692016-07-15 11:29:16 +000050} // namespace rename
51} // namespace clang
Manuel Klimekde237262014-08-20 01:39:05 +000052
Kirill Bobyrev405699e2016-08-19 09:36:14 +000053#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_RENAME_USR_FINDING_ACTION_H