clang-tools 8.0.0

FindAllSymbolsAction.h
Go to the documentation of this file.
1 //===-- FindAllSymbolsAction.h - find all symbols action --------*- C++ -*-===//
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 #ifndef LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_FIND_ALL_SYMBOLS_ACTION_H
11 #define LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_FIND_ALL_SYMBOLS_ACTION_H
12
13 #include "FindAllSymbols.h"
14 #include "HeaderMapCollector.h"
15 #include "PragmaCommentHandler.h"
16 #include "clang/ASTMatchers/ASTMatchFinder.h"
17 #include "clang/Frontend/CompilerInstance.h"
18 #include "clang/Frontend/FrontendAction.h"
19 #include "clang/Tooling/Tooling.h"
20 #include "llvm/ADT/StringRef.h"
21 #include <memory>
22
23 namespace clang {
24 namespace find_all_symbols {
25
26 class FindAllSymbolsAction : public clang::ASTFrontendAction {
27 public:
28 explicit FindAllSymbolsAction(
29 SymbolReporter *Reporter,
30 const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap = nullptr);
31
32 std::unique_ptr<clang::ASTConsumer>
33 CreateASTConsumer(clang::CompilerInstance &Compiler,
34 StringRef InFile) override;
35
36 private:
37 SymbolReporter *const Reporter;
38 clang::ast_matchers::MatchFinder MatchFinder;
39 HeaderMapCollector Collector;
40 PragmaCommentHandler Handler;
41 FindAllSymbols Matcher;
42 };
43
44 class FindAllSymbolsActionFactory : public tooling::FrontendActionFactory {
45 public:
46 FindAllSymbolsActionFactory(
47 SymbolReporter *Reporter,
48 const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap = nullptr)
49 : Reporter(Reporter), RegexHeaderMap(RegexHeaderMap) {}
50
51 clang::FrontendAction *create() override {
52 return new FindAllSymbolsAction(Reporter, RegexHeaderMap);
53 }
54
55 private:
56 SymbolReporter *const Reporter;
57 const HeaderMapCollector::RegexHeaderMap *const RegexHeaderMap;
58 };
59
60 } // namespace find_all_symbols
61 } // namespace clang
62
63 #endif // LLVM_CLANG_TOOLS_EXTRA_FIND_ALL_SYMBOLS_FIND_ALL_SYMBOLS_ACTION_H
clang::find_all_symbols::FindAllSymbolsAction::CreateASTConsumer
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef InFile) override
Definition: FindAllSymbolsAction.cpp:28
clang::find_all_symbols::FindAllSymbolsActionFactory::FindAllSymbolsActionFactory
FindAllSymbolsActionFactory(SymbolReporter *Reporter, const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap=nullptr)
Definition: FindAllSymbolsAction.h:46
clang::find_all_symbols::HeaderMapCollector
HeaderMappCollector collects all remapping header files.
Definition: HeaderMapCollector.h:23
clang::find_all_symbols::FindAllSymbolsActionFactory::create
clang::FrontendAction * create() override
Definition: FindAllSymbolsAction.h:51
HeaderMapCollector.h
clang::find_all_symbols::FindAllSymbolsAction
Definition: FindAllSymbolsAction.h:26
clang::find_all_symbols::FindAllSymbols
FindAllSymbols collects all classes, free standing functions and global variables with some extra inf...
Definition: FindAllSymbols.h:35
clang::find_all_symbols::HeaderMapCollector::RegexHeaderMap
std::vector< std::pair< const char *, const char * > > RegexHeaderMap
Definition: HeaderMapCollector.h:26
PragmaCommentHandler.h
FindAllSymbols.h
clang::find_all_symbols::SymbolReporter
An interface for classes that collect symbols.
Definition: SymbolReporter.h:19
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::find_all_symbols::FindAllSymbolsActionFactory
Definition: FindAllSymbolsAction.h:44
clang::find_all_symbols::FindAllSymbolsAction::FindAllSymbolsAction
FindAllSymbolsAction(SymbolReporter *Reporter, const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap=nullptr)
Definition: FindAllSymbolsAction.cpp:19
clang::find_all_symbols::PragmaCommentHandler
PragmaCommentHandler parses pragma comment on include files to determine when we should include a dif...
Definition: PragmaCommentHandler.h:28