P4C
The P4 Compiler
Loading...
Searching...
No Matches
context.h
1#ifndef BACKENDS_P4TOOLS_COMMON_COMPILER_CONTEXT_H_
2#define BACKENDS_P4TOOLS_COMMON_COMPILER_CONTEXT_H_
3
4#include "backends/p4tools/common/compiler/configuration.h"
5#include "frontends/common/parser_options.h"
6
7namespace P4::P4Tools {
8
10template <typename OptionsType>
11class CompileContext : public virtual P4CContext {
12 public:
16
17 CompileContext() = default;
18
19 template <typename OptionsDerivedType>
21 : _optionsInstance(context.options()) {}
22
24 OptionsType &options() override { return _optionsInstance; }
25
26 protected:
28
29 private:
31 OptionsType _optionsInstance;
32};
33
34} // namespace P4::P4Tools
35
36#endif /* BACKENDS_P4TOOLS_COMMON_COMPILER_CONTEXT_H_ */
Definition parser_options.h:118
A compilation context for P4Tools that provides a custom compiler configuration.
Definition context.h:11
const CompilerConfiguration & getConfigImpl() override
Definition context.h:27
OptionsType & options() override
Definition context.h:24
static CompileContext & get()
Definition context.h:15
Definition backends/p4tools/common/compiler/configuration.h:12
static const CompilerConfiguration & get()
Definition backends/p4tools/common/compiler/configuration.h:17
Definition common/compiler/compiler_result.cpp:3
static CompileContextType & top()
Definition compile_context.h:48