VapourSynth-llvmexpr
Loading...
Searching...
No Matches
AnalysisManager.hpp
Go to the documentation of this file.
1
19
20#ifndef LLVMEXPR_ANALYSIS_FRAMEWORK_ANALYSIS_MANAGER_HPP
21#define LLVMEXPR_ANALYSIS_FRAMEWORK_ANALYSIS_MANAGER_HPP
22
24#include "AnalysisResults.hpp"
25#include "Pass.hpp"
26#include "PreservedAnalyses.hpp"
27
28#include <vector>
29
30namespace analysis {
31
33 public:
34 AnalysisManager(const std::vector<Token>& tokens_in,
35 bool mirror_boundary_in, int expected_final_depth_in = 1);
36
37 template <typename PassT> typename PassT::Result& getResult() {
38 if (!results.template hasResult<PassT>()) {
39 PassT pass;
40 auto result = pass.run(tokens, *this);
41 results.template setResult<PassT>(std::move(result));
42 }
43 return results.template getResult<PassT>();
44 }
45
46 template <typename PassT> const typename PassT::Result& getResult() const {
47 return results.template getResult<PassT>();
48 }
49
50 template <typename PassT> [[nodiscard]] bool hasResult() const {
51 return results.template hasResult<PassT>();
52 }
53
54 void invalidate(const PreservedAnalyses& pa);
55
56 [[nodiscard]] const std::vector<Token>& getTokens() const { return tokens; }
57
58 [[nodiscard]] bool getMirrorBoundary() const { return mirror_boundary; }
59
60 [[nodiscard]] int getExpectedFinalDepth() const {
61 return expected_final_depth;
62 }
63
64 private:
65 const std::vector<Token>& tokens;
66 AnalysisResults results;
67 bool mirror_boundary;
68 int expected_final_depth;
69};
70
71} // namespace analysis
72
73#endif // LLVMEXPR_ANALYSIS_FRAMEWORK_ANALYSIS_MANAGER_HPP
const PassT::Result & getResult() const
const std::vector< Token > & getTokens() const
AnalysisManager(const std::vector< Token > &tokens_in, bool mirror_boundary_in, int expected_final_depth_in=1)
void invalidate(const PreservedAnalyses &pa)