P4C
The P4 Compiler
Loading...
Searching...
No Matches
common/compiler/compiler_result.h
1/*
2 * SPDX-FileCopyrightText: 2024 The P4 Language Consortium
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_
8#define BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_
9
10#include <functional>
11#include <optional>
12
13#include "ir/ir.h"
14#include "lib/castable.h"
15
16namespace P4::P4Tools {
17
20class CompilerResult : public ICastable {
21 private:
23 std::reference_wrapper<const IR::P4Program> program;
24
25 public:
26 explicit CompilerResult(const IR::P4Program &program);
27
30 [[nodiscard]] const IR::P4Program &getProgram() const;
31
32 DECLARE_TYPEINFO(CompilerResult);
33};
34
37using CompilerResultOrError = std::optional<std::reference_wrapper<const CompilerResult>>;
38
39} // namespace P4::P4Tools
40
41#endif /* BACKENDS_P4TOOLS_COMMON_COMPILER_COMPILER_RESULT_H_ */
Definition castable.h:27
const IR::P4Program & getProgram() const
Definition common/compiler/compiler_result.cpp:9
Definition common/compiler/compiler_result.cpp:7
std::optional< std::reference_wrapper< const CompilerResult > > CompilerResultOrError
Definition common/compiler/compiler_result.h:37