P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4CContext Class Referenceabstract

#include <parser_options.h>

Inheritance diagram for P4::P4CContext:
[legend]

Public Member Functions

DiagnosticAction getDefaultInfoDiagnosticAction () final
 
DiagnosticAction getDefaultWarningDiagnosticAction () final
 
virtual ParserOptionsoptions ()=0
 
void setDefaultInfoDiagnosticAction (DiagnosticAction action)
 set the default diagnostic action for calls to P4::info().
 
void setDefaultWarningDiagnosticAction (DiagnosticAction action)
 set the default diagnostic action for calls to P4::warning().
 
void setDiagnosticAction (std::string_view diagnostic, DiagnosticAction action)
 Set the action to take for the given diagnostic.
 
- Public Member Functions inherited from P4::BaseCompileContext
virtual ErrorReportererrorReporter ()
 
virtual DiagnosticAction getDefaultErrorDiagnosticAction ()
 

Static Public Member Functions

static P4CContextget ()
 
static const P4CConfigurationgetConfig ()
 
- Static Public Member Functions inherited from P4::BaseCompileContext
static BaseCompileContextget ()
 

Protected Member Functions

virtual const P4CConfigurationgetConfigImpl ()
 
virtual bool isRecognizedDiagnostic (cstring diagnostic)
 
- Protected Member Functions inherited from P4::BaseCompileContext
 BaseCompileContext (const BaseCompileContext &other)=default
 
BaseCompileContextoperator= (const BaseCompileContext &other)=default
 
- Protected Member Functions inherited from P4::ICompileContext

Detailed Description

A compilation context which exposes compiler options and a compiler configuration.

Member Function Documentation

◆ get()

P4CContext & P4CContext::get ( )
static
Returns
the current compilation context, which must inherit from P4CContext.

◆ getConfig()

const P4CConfiguration & P4CContext::getConfig ( )
static
Returns
the compiler configuration for the current compilation context. If there is no current compilation context, the default configuration is returned.

◆ getConfigImpl()

const P4CConfiguration & P4CContext::getConfigImpl ( )
protectedvirtual
Returns
the compiler configuration associated with this type of compilation context.

Reimplemented in P4::P4Tools::CompileContext< OptionsType >.

◆ getDefaultInfoDiagnosticAction()

DiagnosticAction P4::P4CContext::getDefaultInfoDiagnosticAction ( )
inlinefinalvirtual
Returns
the default diagnostic action for calls to P4::info().

Reimplemented from P4::BaseCompileContext.

◆ getDefaultWarningDiagnosticAction()

DiagnosticAction P4::P4CContext::getDefaultWarningDiagnosticAction ( )
inlinefinalvirtual
Returns
the default diagnostic action for calls to P4::warning().

Reimplemented from P4::BaseCompileContext.

◆ isRecognizedDiagnostic()

bool P4CContext::isRecognizedDiagnostic ( cstring diagnostic)
protectedvirtual
Returns
true if the given diagnostic is known to be valid. This is intended to help the user find misspelled diagnostics and the like; it doesn't affect functionality.

◆ options()

virtual ParserOptions & P4::P4CContext::options ( )
pure virtual
Returns
the compiler options for this compilation context.

Implemented in P4::P4CContextWithOptions< OptionsType >, and P4::P4Tools::CompileContext< OptionsType >.