1//===- ASTSrcLocProcessor.h ---------------------------------*- 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#ifndef LLVM_CLANG_TOOLING_DUMPTOOL_ASTSRCLOCPROCESSOR_H
10#define LLVM_CLANG_TOOLING_DUMPTOOL_ASTSRCLOCPROCESSOR_H
11
12#include "APIData.h"
13#include "clang/ASTMatchers/ASTMatchFinder.h"
14#include "llvm/ADT/StringRef.h"
15#include <memory>
16#include <string>
17#include <vector>
18
19namespace clang {
20
21class CompilerInstance;
22
23namespace tooling {
24
25class ASTSrcLocProcessor : public ast_matchers::MatchFinder::MatchCallback {
26public:
27 explicit ASTSrcLocProcessor(StringRef JsonPath);
28
29 std::unique_ptr<ASTConsumer> createASTConsumer(CompilerInstance &Compiler,
30 StringRef File);
31
32 void generate();
33 void generateEmpty();
34
35private:
36 void run(const ast_matchers::MatchFinder::MatchResult &Result) override;
37
38 std::optional<TraversalKind> getCheckTraversalKind() const override {
39 return TK_IgnoreUnlessSpelledInSource;
40 }
41
42 llvm::StringMap<std::string> ClassInheritance;
43 llvm::StringMap<std::vector<StringRef>> ClassesInClade;
44 llvm::StringMap<ClassData> ClassEntries;
45
46 std::string JsonPath;
47 std::unique_ptr<clang::ast_matchers::MatchFinder> Finder;
48};
49
50} // namespace tooling
51} // namespace clang
52
53#endif
54

source code of clang/lib/Tooling/DumpTool/ASTSrcLocProcessor.h