clang-tools  7.0.0
FindAllSymbolsAction.cpp
Go to the documentation of this file.
1 //===-- FindAllSymbolsAction.cpp - 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 #include "FindAllSymbolsAction.h"
11 #include "FindAllMacros.h"
12 #include "clang/Lex/PPCallbacks.h"
13 #include "clang/Lex/Preprocessor.h"
14 #include "llvm/ADT/STLExtras.h"
15 
16 namespace clang {
17 namespace find_all_symbols {
18 
20  SymbolReporter *Reporter,
21  const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap)
22  : Reporter(Reporter), Collector(RegexHeaderMap), Handler(&Collector),
23  Matcher(Reporter, &Collector) {
24  Matcher.registerMatchers(&MatchFinder);
25 }
26 
27 std::unique_ptr<ASTConsumer>
28 FindAllSymbolsAction::CreateASTConsumer(CompilerInstance &Compiler,
29  StringRef InFile) {
30  Compiler.getPreprocessor().addCommentHandler(&Handler);
31  Compiler.getPreprocessor().addPPCallbacks(llvm::make_unique<FindAllMacros>(
32  Reporter, &Compiler.getSourceManager(), &Collector));
33  return MatchFinder.newASTConsumer();
34 }
35 
36 } // namespace find_all_symbols
37 } // namespace clang
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef InFile) override
std::vector< std::pair< const char *, const char * > > RegexHeaderMap
An interface for classes that collect symbols.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
FindAllSymbolsAction(SymbolReporter *Reporter, const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap=nullptr)
void registerMatchers(ast_matchers::MatchFinder *MatchFinder)