ASTSrcLocProcessor.h 1.5 KB

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