1#ifndef BACKENDS_P4TOOLS_COMMON_LIB_NAMESPACE_CONTEXT_H_
2#define BACKENDS_P4TOOLS_COMMON_LIB_NAMESPACE_CONTEXT_H_
7#include "ir/declaration.h"
9#include "lib/cstring.h"
16 const IR::INamespace *curNamespace;
20 mutable std::optional<std::set<cstring>> usedNames;
23 : curNamespace(ns), outer(outer) {}
28 const IR::IDeclaration *findNestedDecl(
const IR::INestedNamespace *nestedNameSpace,
29 const IR::Path *path)
const;
The Declaration interface, representing objects with names.
Definition declaration.h:26
Represents a stack of namespaces.
Definition namespace_context.h:14
const IR::IDeclaration * findDecl(const IR::Path *path) const
Looks up a declaration in this context. A BUG occurs if the declaration cannot be found.
Definition namespace_context.cpp:58
const NamespaceContext * push(const IR::INamespace *ns) const
Definition namespace_context.cpp:14
const NamespaceContext * pop() const
Definition namespace_context.cpp:18
const std::set< cstring > & getUsedNames() const
Definition namespace_context.cpp:94
static const NamespaceContext * Empty
Represents the empty namespace context.
Definition namespace_context.h:33