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
7
namespace
P4::P4Tools
{
8
10
template
<
typename
OptionsType>
11
class
CompileContext
:
public
virtual
P4CContext
{
12
public
:
15
static
CompileContext
&
get
() {
return
CompileContextStack::top<CompileContext>
(); }
16
17
CompileContext
() =
default
;
18
19
template
<
typename
OptionsDerivedType>
20
explicit
CompileContext
(
CompileContext<OptionsDerivedType>
&context)
21
: _optionsInstance(context.
options
()) {}
22
24
OptionsType &
options
()
override
{
return
_optionsInstance; }
25
26
protected
:
27
const
CompilerConfiguration
&
getConfigImpl
()
override
{
return
CompilerConfiguration::get
(); }
28
29
private
:
31
OptionsType _optionsInstance;
32
};
33
34
}
// namespace P4::P4Tools
35
36
#endif
/* BACKENDS_P4TOOLS_COMMON_COMPILER_CONTEXT_H_ */
P4::P4CContext
Definition
parser_options.h:118
P4::P4Tools::CompileContext
A compilation context for P4Tools that provides a custom compiler configuration.
Definition
context.h:11
P4::P4Tools::CompileContext::getConfigImpl
const CompilerConfiguration & getConfigImpl() override
Definition
context.h:27
P4::P4Tools::CompileContext::options
OptionsType & options() override
Definition
context.h:24
P4::P4Tools::CompileContext::get
static CompileContext & get()
Definition
context.h:15
P4::P4Tools::CompilerConfiguration
Definition
backends/p4tools/common/compiler/configuration.h:12
P4::P4Tools::CompilerConfiguration::get
static const CompilerConfiguration & get()
Definition
backends/p4tools/common/compiler/configuration.h:17
P4::P4Tools
Definition
common/compiler/compiler_result.cpp:3
P4::CompileContextStack::top
static CompileContextType & top()
Definition
compile_context.h:48
backends
p4tools
common
compiler
context.h
Generated by
1.12.0