P4C
The P4 Compiler
Loading...
Searching...
No Matches
common/compiler/compiler_result.h
1#ifndef BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_
2#define BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_
3
4#include <functional>
5#include <optional>
6
7#include "ir/ir.h"
8#include "lib/castable.h"
9
10namespace P4::P4Tools {
11
14class CompilerResult : public ICastable {
15 private:
17 std::reference_wrapper<const IR::P4Program> program;
18
19 public:
20 explicit CompilerResult(const IR::P4Program &program);
21
24 [[nodiscard]] const IR::P4Program &getProgram() const;
25
26 DECLARE_TYPEINFO(CompilerResult);
27};
28
31using CompilerResultOrError = std::optional<std::reference_wrapper<const CompilerResult>>;
32
33} // namespace P4::P4Tools
34
35#endif /* BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_ */
Definition castable.h:36
Definition common/compiler/compiler_result.h:14
const IR::P4Program & getProgram() const
Definition common/compiler/compiler_result.cpp:5
Definition common/compiler/compiler_result.cpp:3
std::optional< std::reference_wrapper< const CompilerResult > > CompilerResultOrError
Definition common/compiler/compiler_result.h:31