clang-tools  14.0.0git
FindAllSymbolsAction.cpp
Go to the documentation of this file.
1 //===-- FindAllSymbolsAction.cpp - find all symbols action --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "FindAllSymbolsAction.h"
10 #include "FindAllMacros.h"
11 #include "clang/Lex/PPCallbacks.h"
12 #include "clang/Lex/Preprocessor.h"
13 #include "llvm/ADT/STLExtras.h"
14 
15 namespace clang {
16 namespace find_all_symbols {
17 
19  SymbolReporter *Reporter,
20  const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap)
21  : Reporter(Reporter), Collector(RegexHeaderMap), Handler(&Collector),
22  Matcher(Reporter, &Collector) {
23  Matcher.registerMatchers(&MatchFinder);
24 }
25 
26 std::unique_ptr<ASTConsumer>
27 FindAllSymbolsAction::CreateASTConsumer(CompilerInstance &Compiler,
28  StringRef InFile) {
29  Compiler.getPreprocessor().addCommentHandler(&Handler);
30  Compiler.getPreprocessor().addPPCallbacks(std::make_unique<FindAllMacros>(
31  Reporter, &Compiler.getSourceManager(), &Collector));
32  return MatchFinder.newASTConsumer();
33 }
34 
35 } // namespace find_all_symbols
36 } // namespace clang
FindAllSymbolsAction.h
FindAllMacros.h
clang::find_all_symbols::HeaderMapCollector::RegexHeaderMap
std::vector< std::pair< const char *, const char * > > RegexHeaderMap
Definition: HeaderMapCollector.h:25
clang::find_all_symbols::FindAllSymbolsAction::FindAllSymbolsAction
FindAllSymbolsAction(SymbolReporter *Reporter, const HeaderMapCollector::RegexHeaderMap *RegexHeaderMap=nullptr)
Definition: FindAllSymbolsAction.cpp:18
clang::find_all_symbols::FindAllSymbolsAction::CreateASTConsumer
std::unique_ptr< clang::ASTConsumer > CreateASTConsumer(clang::CompilerInstance &Compiler, StringRef InFile) override
Definition: FindAllSymbolsAction.cpp:27
Collector
std::shared_ptr< SymbolCollector > Collector
Definition: SymbolCollectorTests.cpp:257
clang::find_all_symbols::FindAllSymbols::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *MatchFinder)
Definition: FindAllSymbols.cpp:116
clang::find_all_symbols::SymbolReporter
An interface for classes that collect symbols.
Definition: SymbolReporter.h:18
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27