P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::NamespaceContext Class Reference

Represents a stack of namespaces. More...

#include <namespace_context.h>

Public Member Functions

const IR::IDeclarationfindDecl (const IR::Path *path) const
 Looks up a declaration in this context. A BUG occurs if the declaration cannot be found.
 
const std::set< cstring > & getUsedNames () const
 
const NamespaceContextpop () const
 
const NamespaceContextpush (const IR::INamespace *ns) const
 
and @sep are passed to
Returns
a name that is fresh in this context. The given cstring::make_unique.
cstring genName (cstring name, char sep) const
 

Static Public Attributes

static const NamespaceContextEmpty = new NamespaceContext(nullptr, nullptr)
 Represents the empty namespace context.
 

Detailed Description

Represents a stack of namespaces.

Member Function Documentation

◆ getUsedNames()

const std::set< cstring > & P4::P4Tools::NamespaceContext::getUsedNames ( ) const
Returns
all names that appear in this context and all outer contexts.

◆ pop()

const NamespaceContext * P4::P4Tools::NamespaceContext::pop ( ) const
Returns
the namespace context surrounding this context.

◆ push()

const NamespaceContext * P4::P4Tools::NamespaceContext::push ( const IR::INamespace * ns) const
Returns
a new namespace context, representing the given namespace @ns pushed onto this namespace context.